20 pips a day isn't too much to ask . . .
Similar Threads
I will code your pivot EAs for no charge 23 replies
I will code your scalping EAs for no charge 163 replies
Oanda MT4 - Indicators and EAs not showing 2 replies
EAs and indicators relating to moutaki... 22 replies
InterbankFX has loaded its MT4 platform with custom EAs, indicators and scripts 1 reply
DislikedIf you don't have a line that starts . . SetIndexArrow( . . . . then you need to add one . . such as . .
SetIndexArrow( 0, 108);
Add it under the line you have posted above . .Ignored
SetIndexArrow (0, 108 ):
when I compiled I got error, Draw_Arrow - variable not defined
DislikedI now have, SetIndexStyle (0, Draw_Arrow );
SetIndexArrow (0, 108 ):
when I compiled I got error, Draw_Arrow - variable not definedIgnored
to SetIndexStyle (0, Draw_Arrow ); ??
SetIndexStyle (0, DRAW_ARROW ); is correct.
20 pips a day isn't too much to ask . . .
DislikedAnyone help with this, i've tried compiling with metaeditor what i think i need but it keeps giving errors. I only need the camarilla to be adjustable.Ignored
from what I have gathered, I guessed you probably just wanted the camarilla indicator to be able to adjust manually according to the yesterday's high and low and closing inputs that will be indicated by you. Like what Pivot Manual.mq4 indicator is doing, but with the calculations and display like that of camarilla.
Here is your requested "Adjustable Manual" version of your camarilla indicator.
I have added a few settings, here's a short explanation on what they do:
Use_Manual
When this is set to true, it will take consideration the values of the 3 inputs listed below. Namely, "Yesterdays_High", "Yesterdays_Low" and "Yesterdays_Close". When this is set to false, it reverts back to functions like the original camarilla.
Yesterdays_High
Price level of Yesterday's High.
Yesterdays_Low
Price level of Yesterday's Low.
Yesterdays_Close
Price level of Yesterday's Close
See if this is what you want.
Attached File(s)
camarilla v2.mq4
5 KB
|
606 downloads
DislikedHi neil324,
from what I have gathered, I guessed you probably just wanted the camarilla indicator to be able to adjust manually according to the yesterday's high and low and closing inputs that will be indicated by you. Like what Pivot Manual.mq4 indicator is doing, but with the calculations and display like that of camarilla.
Here is your requested "Adjustable Manual" version of your camarilla indicator.
I have added a few settings, here's a short explanation on what they do:
Use_Manual
When this is set to true, it will take...Ignored
Strange there is no mention of L5 or H5 in the original but it still draws it on the charts.
DislikedIt's not showing a pivot point, L5 SB Target or H5 LB Target like the original though.
Strange there is no mention of L5 or H5 in the original but it still draws it on the charts.Ignored
Well found out why it's not drawing L5 & H5, the camarilladt i have been using is different to the one i posted earlyer. Don't care about the standard pivots or fib pivots. Just wan't the cam pivot to be adjustable using the equation that this indicator uses.
lol, feel stupid now
lol, feel stupid now
Attached File(s)
camarilladt.mq4
47 KB
|
484 downloads
DislikedIt's not showing a pivot point, L5 SB Target or H5 LB Target like the original though.
Strange there is no mention of L5 or H5 in the original but it still draws it on the charts.Ignored
Added some new features to this version.
font_size
You can adjust the value of this setting to make the fonts bigger or smaller according to your preference.
Lines_Color
This represents the color for the lines L3, L4, L5, H3, H4, H5, etc. Default value is Red. You can change it to another color if you wish.
Show_Pivot_Line
When this is set to true, it will show the middle pivot line on screen.
Pivot_Color
This will adjust its color.
Show_Info
When this is set to true, it will display various information on the top-left hand corner of your screen.
Attached File(s)
camarilla v2.1.mq4
7 KB
|
533 downloads
Just had a mess about with the indicator, the equation seems the same and is working great. Many many Thanks
Attached File(s)
camarilladt.mq4
47 KB
|
555 downloads
cam,new.mq4
5 KB
|
602 downloads
Hello
Can you add sound alert and sms alert to this indicator?
I use [email protected] to received email.
The alert must work to the first green bar and the first red bar.
thank you in advance
Can you add sound alert and sms alert to this indicator?
I use [email protected] to received email.
The alert must work to the first green bar and the first red bar.
thank you in advance
Attached File(s)
INDICATOR.mq4
2 KB
|
999 downloads
Can someone please help me with this Indicator. I need this indicator to alert when the price closes above the moving average and when the price closes below the lmoving agerage and a and pop up window indicating which pair is meets the condition.
Thank you in advance
Thank you in advance
Attached File(s)
Copy of sidus v.2.ex4
4 KB
|
510 downloads
Anyone help with this error
2;75;Crogram FilesSmart Live Spread Bet MT4expertsindicatorsbbb.mq4;120:41;'D4' - variable not defined
2;75;Crogram FilesSmart Live Spread Bet MT4expertsindicatorsbbb.mq4;121:41;'D3' - variable not defined
2;75;Crogram FilesSmart Live Spread Bet MT4expertsindicatorsbbb.mq4;122:59;'D3' - variable not defined
2;75;Crogram FilesSmart Live Spread Bet MT4expertsindicatorsbbb.mq4;123:59;'D4' - variable not defined
Trying to define D, taken from another indicator where it works and ive placed into another indicator in the same place.
D = (day_high - day_low);
In this equation
P = (yesterday_high + yesterday_low + yesterday_close)/3;
H5 = (yesterday_high/yesterday_low)*yesterday_close;
H4 = ((yesterday_high - yesterday_low)* D4) + yesterday_close;
H3 = ((yesterday_high - yesterday_low)* D3) + yesterday_close;
L3 = yesterday_close - ((yesterday_high - yesterday_low)*(D3));
L4 = yesterday_close - ((yesterday_high - yesterday_low)*(D4));
L5 = yesterday_close - (H5 - yesterday_close);
//+------------------------------------------------------------------+
//| ForexMasterMaker.com |
//| Pivots.mq4 |
//+------------------------------------------------------------------+
#property copyright "ForexMasterMaker.com, 2005"
#property link "http://www.forexmastermaker.com."
#property indicator_chart_window
//---- input parameters
extern int GMTshift=7;
extern bool Use_Manual = true;
extern double Yesterdays_High = 1.43160;
extern double Yesterdays_Low = 1.42070;
extern double Yesterdays_Close = 1.42558;
extern int font_size = 8;
extern color Lines_Color = Red;
extern color Fonts_Color = Red;
extern bool Show_Pivot_Line = true;
extern color Pivot_Color = Cyan;
extern color PivotFont_Color = Red;
extern bool Show_Info = true;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
//---- TODO: add your code here
double day_high=0;
double day_low=0;
double yesterday_high=0;
double yesterday_open=0;
double yesterday_low=0;
double yesterday_close=0;
double today_open=0;
double P=0,S=0,R=0,S1=0,H4=0,S2=0,R2=0,S3=0,L4=0,nQ=0,nD=0,D=0;
double H3,H2,H1,L1,L2,L3,H5,L5;
int cnt=720;
double cur_day=0;
double prev_day=0;
double rates_d1[2][6];
int index;
string commentstr;
//---- exit if period is greater than daily charts
if(Period() > 1440)
{
Print("Error - Chart period is greater than 1 day.");
return(-1); // then exit
}
//---- Get new daily prices & calculate pivots
while (cnt!= 0)
{
cur_day = TimeDay(Time[cnt]- (GMTshift*3600));
if (prev_day != cur_day)
{
yesterday_close = Close[cnt+1];
today_open = Open[cnt];
yesterday_high = day_high;
yesterday_low = day_low;
day_high = High[cnt];
day_low = Low[cnt];
prev_day = cur_day;
if(Use_Manual == true)
{
yesterday_high = Yesterdays_High;
yesterday_low = Yesterdays_Low;
yesterday_close = Yesterdays_Close;
}
}
if (High[cnt]>day_high)
{
day_high = High[cnt];
}
if (Low[cnt]<day_low)
{
day_low = Low[cnt];
}
//SetIndexValue(cnt, 0);
cnt--;
}
D = (day_high - day_low);
//------ Pivot Points ------
P = (yesterday_high + yesterday_low + yesterday_close)/3;
H5 = (yesterday_high/yesterday_low)*yesterday_close;
H4 = ((yesterday_high - yesterday_low)* D4) + yesterday_close;
H3 = ((yesterday_high - yesterday_low)* D3) + yesterday_close;
L3 = yesterday_close - ((yesterday_high - yesterday_low)*(D3));
L4 = yesterday_close - ((yesterday_high - yesterday_low)*(D4));
L5 = yesterday_close - (H5 - yesterday_close);
//------ DRAWING LINES ------
Comment("Camarilla Levels by www.ForexMasterMaker.com");
commentstr = "Yesterdays High : "+yesterday_high+"\nYesterdays Low : "+yesterday_low+"\nYesterdays Close : "+yesterday_close+"\nPivots : "+DoubleToStr(P,Digits);
if(Show_Info == true)
{
Comment(commentstr);
}
else if(Show_Info == false)
{
index = StringFind(commentstr,"Yesterdays High", 0);
if(index != -1)
{
Comment("");
}
}
ObjectDelete("L5_Line");
ObjectDelete("L4_Line");
ObjectDelete("L3_Line");
ObjectDelete("H3_Line");
ObjectDelete("H4_Line");
ObjectDelete("H5_Line");
ObjectDelete("P_Line");
if(Show_Pivot_Line==true)
{
ObjectCreate("P_Line", OBJ_HLINE,0, CurTime(),P);
ObjectSet("P_Line",OBJPROP_COLOR,Pivot_Color);
ObjectSet("P_Line",OBJPROP_STYLE,STYLE_DASH);
}
ObjectCreate("L5_Line", OBJ_HLINE,0, CurTime(),L5);
ObjectSet("L5_Line",OBJPROP_COLOR,Lines_Color);
ObjectSet("L5_Line",OBJPROP_STYLE,STYLE_SOLID);
ObjectCreate("L4_Line", OBJ_HLINE,0, CurTime(),L4);
ObjectSet("L4_Line",OBJPROP_COLOR,Lines_Color);
ObjectSet("L4_Line",OBJPROP_STYLE,STYLE_SOLID);
ObjectCreate("L3_Line", OBJ_HLINE,0, CurTime(),L3);
ObjectSet("L3_Line",OBJPROP_COLOR,Lines_Color);
ObjectSet("L3_Line",OBJPROP_STYLE,STYLE_SOLID);
ObjectCreate("H3_Line", OBJ_HLINE,0, CurTime(),H3);
ObjectSet("H3_Line",OBJPROP_COLOR,SpringGreen);
ObjectSet("H3_Line",OBJPROP_STYLE,STYLE_SOLID);
ObjectCreate("H4_Line", OBJ_HLINE,0, CurTime(),H4);
ObjectSet("H4_Line",OBJPROP_COLOR,SpringGreen);
ObjectSet("H4_Line",OBJPROP_STYLE,STYLE_SOLID);
ObjectCreate("H5_Line", OBJ_HLINE,0, CurTime(),H5);
ObjectSet("H5_Line",OBJPROP_COLOR,SpringGreen);
ObjectSet("H5_Line",OBJPROP_STYLE,STYLE_SOLID);
ObjectsRedraw();
// --- Typing Labels
if(ObjectFind("L3 label") != 0)
{
ObjectCreate("L3 label", OBJ_TEXT, 0, Time[0], L3);
ObjectSetText("L3 label", " L3 SHORT ", font_size, "Arial", Fonts_Color);
}
else
{
ObjectMove("L3 label", 0, Time[0], L3);
}
if(ObjectFind("L4 label") != 0)
{
ObjectCreate("L4 label", OBJ_TEXT, 0, Time[0], L4);
ObjectSetText("L4 label", " L4 SHORT BREAKOUT ", font_size, "Arial", Fonts_Color);
}
else
{
ObjectMove("L4 label", 0, Time[0], L4);
}
if(ObjectFind("L5 label") != 0)
{
ObjectCreate("L5 label", OBJ_TEXT, 0, Time[0], L5);
ObjectSetText("L5 label", " L5 SB TARGET", font_size, "Arial", Fonts_Color);
}
else
{
ObjectMove("L5 label", 0, Time[0], L5);
}
if(ObjectFind("H5 label") != 0)
{
ObjectCreate("H5 label", OBJ_TEXT, 0, Time[0], H5);
ObjectSetText("H5 label", " H5 LB TARGET", font_size, "Arial", Fonts_Color);
}
else
{
ObjectMove("H5 label", 0, Time[0], H5);
}
if(ObjectFind("H4 label") != 0)
{
ObjectCreate("H4 label", OBJ_TEXT, 0, Time[0], H4);
ObjectSetText("H4 label", " H4 LONG BREAKOUT", font_size, "Arial", Fonts_Color);
}
else
{
ObjectMove("H4 label", 0, Time[0], H4);
}
if(ObjectFind("H3 label") != 0)
{
ObjectCreate("H3 label", OBJ_TEXT, 0, Time[0], H3);
ObjectSetText("H3 label", " H3 SHORT", font_size, "Arial", Fonts_Color);
}
else
{
ObjectMove("H3 label", 0, Time[0], H3);
}
if(ObjectFind("P label") != 0)
{
ObjectCreate("P label", OBJ_TEXT, 0, Time[0], P);
ObjectSetText("P label", " PIVOT ", font_size, "Arial", PivotFont_Color);
}
else
{
ObjectMove("P label", 0, Time[0], P);
}
return(0);
}
//+------------------------------------------------------------------+
2;75;Crogram FilesSmart Live Spread Bet MT4expertsindicatorsbbb.mq4;120:41;'D4' - variable not defined
2;75;Crogram FilesSmart Live Spread Bet MT4expertsindicatorsbbb.mq4;121:41;'D3' - variable not defined
2;75;Crogram FilesSmart Live Spread Bet MT4expertsindicatorsbbb.mq4;122:59;'D3' - variable not defined
2;75;Crogram FilesSmart Live Spread Bet MT4expertsindicatorsbbb.mq4;123:59;'D4' - variable not defined
Trying to define D, taken from another indicator where it works and ive placed into another indicator in the same place.
D = (day_high - day_low);
In this equation
P = (yesterday_high + yesterday_low + yesterday_close)/3;
H5 = (yesterday_high/yesterday_low)*yesterday_close;
H4 = ((yesterday_high - yesterday_low)* D4) + yesterday_close;
H3 = ((yesterday_high - yesterday_low)* D3) + yesterday_close;
L3 = yesterday_close - ((yesterday_high - yesterday_low)*(D3));
L4 = yesterday_close - ((yesterday_high - yesterday_low)*(D4));
L5 = yesterday_close - (H5 - yesterday_close);
//+------------------------------------------------------------------+
//| ForexMasterMaker.com |
//| Pivots.mq4 |
//+------------------------------------------------------------------+
#property copyright "ForexMasterMaker.com, 2005"
#property link "http://www.forexmastermaker.com."
#property indicator_chart_window
//---- input parameters
extern int GMTshift=7;
extern bool Use_Manual = true;
extern double Yesterdays_High = 1.43160;
extern double Yesterdays_Low = 1.42070;
extern double Yesterdays_Close = 1.42558;
extern int font_size = 8;
extern color Lines_Color = Red;
extern color Fonts_Color = Red;
extern bool Show_Pivot_Line = true;
extern color Pivot_Color = Cyan;
extern color PivotFont_Color = Red;
extern bool Show_Info = true;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
//---- TODO: add your code here
double day_high=0;
double day_low=0;
double yesterday_high=0;
double yesterday_open=0;
double yesterday_low=0;
double yesterday_close=0;
double today_open=0;
double P=0,S=0,R=0,S1=0,H4=0,S2=0,R2=0,S3=0,L4=0,nQ=0,nD=0,D=0;
double H3,H2,H1,L1,L2,L3,H5,L5;
int cnt=720;
double cur_day=0;
double prev_day=0;
double rates_d1[2][6];
int index;
string commentstr;
//---- exit if period is greater than daily charts
if(Period() > 1440)
{
Print("Error - Chart period is greater than 1 day.");
return(-1); // then exit
}
//---- Get new daily prices & calculate pivots
while (cnt!= 0)
{
cur_day = TimeDay(Time[cnt]- (GMTshift*3600));
if (prev_day != cur_day)
{
yesterday_close = Close[cnt+1];
today_open = Open[cnt];
yesterday_high = day_high;
yesterday_low = day_low;
day_high = High[cnt];
day_low = Low[cnt];
prev_day = cur_day;
if(Use_Manual == true)
{
yesterday_high = Yesterdays_High;
yesterday_low = Yesterdays_Low;
yesterday_close = Yesterdays_Close;
}
}
if (High[cnt]>day_high)
{
day_high = High[cnt];
}
if (Low[cnt]<day_low)
{
day_low = Low[cnt];
}
//SetIndexValue(cnt, 0);
cnt--;
}
D = (day_high - day_low);
//------ Pivot Points ------
P = (yesterday_high + yesterday_low + yesterday_close)/3;
H5 = (yesterday_high/yesterday_low)*yesterday_close;
H4 = ((yesterday_high - yesterday_low)* D4) + yesterday_close;
H3 = ((yesterday_high - yesterday_low)* D3) + yesterday_close;
L3 = yesterday_close - ((yesterday_high - yesterday_low)*(D3));
L4 = yesterday_close - ((yesterday_high - yesterday_low)*(D4));
L5 = yesterday_close - (H5 - yesterday_close);
//------ DRAWING LINES ------
Comment("Camarilla Levels by www.ForexMasterMaker.com");
commentstr = "Yesterdays High : "+yesterday_high+"\nYesterdays Low : "+yesterday_low+"\nYesterdays Close : "+yesterday_close+"\nPivots : "+DoubleToStr(P,Digits);
if(Show_Info == true)
{
Comment(commentstr);
}
else if(Show_Info == false)
{
index = StringFind(commentstr,"Yesterdays High", 0);
if(index != -1)
{
Comment("");
}
}
ObjectDelete("L5_Line");
ObjectDelete("L4_Line");
ObjectDelete("L3_Line");
ObjectDelete("H3_Line");
ObjectDelete("H4_Line");
ObjectDelete("H5_Line");
ObjectDelete("P_Line");
if(Show_Pivot_Line==true)
{
ObjectCreate("P_Line", OBJ_HLINE,0, CurTime(),P);
ObjectSet("P_Line",OBJPROP_COLOR,Pivot_Color);
ObjectSet("P_Line",OBJPROP_STYLE,STYLE_DASH);
}
ObjectCreate("L5_Line", OBJ_HLINE,0, CurTime(),L5);
ObjectSet("L5_Line",OBJPROP_COLOR,Lines_Color);
ObjectSet("L5_Line",OBJPROP_STYLE,STYLE_SOLID);
ObjectCreate("L4_Line", OBJ_HLINE,0, CurTime(),L4);
ObjectSet("L4_Line",OBJPROP_COLOR,Lines_Color);
ObjectSet("L4_Line",OBJPROP_STYLE,STYLE_SOLID);
ObjectCreate("L3_Line", OBJ_HLINE,0, CurTime(),L3);
ObjectSet("L3_Line",OBJPROP_COLOR,Lines_Color);
ObjectSet("L3_Line",OBJPROP_STYLE,STYLE_SOLID);
ObjectCreate("H3_Line", OBJ_HLINE,0, CurTime(),H3);
ObjectSet("H3_Line",OBJPROP_COLOR,SpringGreen);
ObjectSet("H3_Line",OBJPROP_STYLE,STYLE_SOLID);
ObjectCreate("H4_Line", OBJ_HLINE,0, CurTime(),H4);
ObjectSet("H4_Line",OBJPROP_COLOR,SpringGreen);
ObjectSet("H4_Line",OBJPROP_STYLE,STYLE_SOLID);
ObjectCreate("H5_Line", OBJ_HLINE,0, CurTime(),H5);
ObjectSet("H5_Line",OBJPROP_COLOR,SpringGreen);
ObjectSet("H5_Line",OBJPROP_STYLE,STYLE_SOLID);
ObjectsRedraw();
// --- Typing Labels
if(ObjectFind("L3 label") != 0)
{
ObjectCreate("L3 label", OBJ_TEXT, 0, Time[0], L3);
ObjectSetText("L3 label", " L3 SHORT ", font_size, "Arial", Fonts_Color);
}
else
{
ObjectMove("L3 label", 0, Time[0], L3);
}
if(ObjectFind("L4 label") != 0)
{
ObjectCreate("L4 label", OBJ_TEXT, 0, Time[0], L4);
ObjectSetText("L4 label", " L4 SHORT BREAKOUT ", font_size, "Arial", Fonts_Color);
}
else
{
ObjectMove("L4 label", 0, Time[0], L4);
}
if(ObjectFind("L5 label") != 0)
{
ObjectCreate("L5 label", OBJ_TEXT, 0, Time[0], L5);
ObjectSetText("L5 label", " L5 SB TARGET", font_size, "Arial", Fonts_Color);
}
else
{
ObjectMove("L5 label", 0, Time[0], L5);
}
if(ObjectFind("H5 label") != 0)
{
ObjectCreate("H5 label", OBJ_TEXT, 0, Time[0], H5);
ObjectSetText("H5 label", " H5 LB TARGET", font_size, "Arial", Fonts_Color);
}
else
{
ObjectMove("H5 label", 0, Time[0], H5);
}
if(ObjectFind("H4 label") != 0)
{
ObjectCreate("H4 label", OBJ_TEXT, 0, Time[0], H4);
ObjectSetText("H4 label", " H4 LONG BREAKOUT", font_size, "Arial", Fonts_Color);
}
else
{
ObjectMove("H4 label", 0, Time[0], H4);
}
if(ObjectFind("H3 label") != 0)
{
ObjectCreate("H3 label", OBJ_TEXT, 0, Time[0], H3);
ObjectSetText("H3 label", " H3 SHORT", font_size, "Arial", Fonts_Color);
}
else
{
ObjectMove("H3 label", 0, Time[0], H3);
}
if(ObjectFind("P label") != 0)
{
ObjectCreate("P label", OBJ_TEXT, 0, Time[0], P);
ObjectSetText("P label", " PIVOT ", font_size, "Arial", PivotFont_Color);
}
else
{
ObjectMove("P label", 0, Time[0], P);
}
return(0);
}
//+------------------------------------------------------------------+
Attached File(s)
cam adjust.mq4
7 KB
|
564 downloads
- Joined Oct 2007 | Status: Member | 1,099 Posts
Can some one here make this indicator work.
Thanks
I need to have 3 buys and 3 sell pairs.
They are
Buys:
EURJPY
USDCHF
GBPUSD
Sells:
EURUSD
USDJPY
GBPCHF
#property indicator_separate_window
#property indicator_buffers 6
#property indicator_color1 Green
#property indicator_color2 Red
#property indicator_color3 DeepSkyBlue
#property indicator_color4 LightGreen
#property indicator_color5 Orange
#property indicator_color6 Yellow
extern bool ShowComments = False;
extern int Xoffset = 0;
extern int Yoffset = 20;
extern string BGMTO = "Broker GMT Offset";
extern string inst = "Set once during non-Daylight Savings Time";
extern int Broker_GMTOffset = -5;
extern string inst2 = "Set Daylight Savings Time twice per year";
extern bool OnDaylightSavingsTime = True;
extern bool UseSpread = True;
extern bool UsePipCurrencyValue = True;
int StartWeeksBack = 0;
extern bool ShowBuysLine = False;
extern bool ShowSellsLine = False;
extern bool ShowTotalLine = True;
extern bool ShowBuyAllLine = False;
extern bool ShowSellAllLine = False;
extern bool DrawObjects = True;
extern color BuyPairs_Color = DeepSkyBlue;
extern color SellPairs_Color = Red;
extern color Positive_Color = DeepSkyBlue;
extern color Negative_Color = Red;
extern bool ShowIndividualGainsLosses = True;
string Pair_Suffix = "",shortname;
int GMTStartHour,BrokerStartHour,StartBar,myXoffset,myYoffset,a=0;
datetime GMT_Time,StartBarOpenTime,Broker_WeekOpenTime,GMT_Forex_WeekOpenTime,Forex_WeekOpenTime_ThisBroker,StartBarTime,EndTime;
bool BuyAllAlertDone,SellAllAlertDone,ExitBuyAlertDone,ExitSellAlertDone;
string TotalProfitBuys,TotalProfitSells,TotalP_L,IfBuyAll_Value,IfSellAll_Value;
color TotalProfitBuysColor,TotalProfitSellsColor,TotalProfitBuyAllColor,TotalProfitSellAllColor;
double BuysSpreadCostTotal,SellsSpreadCostTotal,SpreadCostTotal,LotsForIndis,LastBid;
int BrokerTZ; //zznbrm
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];
double ExtMapBuffer5[];
double ExtMapBuffer6[];
string Pair[6];
double PairPip[6];
double PairSpread[6];
double PairPipValuePerLot[6];
double PairSpreadCost[6];
datetime PairStartTime[6];
double PairStartAsk[6];
double PairStartBid[6];
datetime PairEndTime[6];
double PairEndAsk[6];
double PairEndBid[6];
double Buys[6];
double Sells[6];
double BuysIfSold[6];
double SellsIfBought[6];
double SortingArray[6];
color PairColor[6];
string Position[6];
string PairValue[6];
int digits[6];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
SetLevelValue(0,0);
shortname="T101 IA indi";
IndicatorShortName(shortname);
SetIndexStyle(0,DRAW_LINE);
SetIndexLabel (0, "Buys");
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexStyle(1,DRAW_LINE);
SetIndexLabel (1, "Sells");
SetIndexBuffer(1,ExtMapBuffer2);
SetIndexStyle(2,DRAW_LINE);
SetIndexLabel (2, "Buys and Sells Total");
SetIndexBuffer(2,ExtMapBuffer3);
SetIndexStyle(3,DRAW_LINE);
SetIndexLabel (3, "Total If Buying All");
SetIndexBuffer(3,ExtMapBuffer4);
SetIndexStyle(4,DRAW_LINE);
SetIndexLabel (4, "Total If Selling All");
SetIndexBuffer(4,ExtMapBuffer5);
SetIndexStyle(5,DRAW_LINE);
SetIndexLabel (5, "20 LWMA on Buys and Sells Total");
SetIndexBuffer(5,ExtMapBuffer6);
BrokerTZ = getBrokerTZ(); //zznbrm
ChooseT101PairSet();
DefinePipForEachPair();
//----
return(0);
}
//----
int deinit() {
ObjectsDeleteAll(0);
Comment("");
return(0);
}
//+------------------------------------------------------------------+
//| Accumulation/Distribution |
//+------------------------------------------------------------------+
int start()
{
/*
for(j=0;j<6;j++) {
PairStartTime[j] = iTime(Pair[j],0,iBarShift(Pair[j],0,StartBarTime));
}
*/
if(ShowComments == False) {
myXoffset = Xoffset+0;
myYoffset = Yoffset+0;
} else if(ShowComments == True) {
myXoffset = Xoffset+850;
myYoffset = Yoffset+0;
}
//For comments, to make sure Broker_GMTOffset is correct
if(OnDaylightSavingsTime == True) {
GMT_Time = (TimeCurrent()+(((-Broker_GMTOffset)-1)*60*60));
} else {
GMT_Time = (TimeCurrent()+((-Broker_GMTOffset)*60*60));
}
int OneSecond = 1;
int OneMinute = 60*OneSecond;
int OneHour = 60*OneMinute;
if(OnDaylightSavingsTime == True) {
int DSTOffset = 1;
} else {
DSTOffset = 0;
}
//From http://www.forexmarkethours.com/ :
//Forex market welcomes traders 24 hours a day.
//Forex market opens on Sunday 5 pm EST (10:00 pm GMT), closes on Friday 5 pm EST (10:00 pm GMT).
Broker_WeekOpenTime = calcWeekStart( TimeCurrent(), BrokerTZ ); //zznbrm
GMT_Forex_WeekOpenTime = Broker_WeekOpenTime+((22-TimeHour(Broker_WeekOpenTime))*OneHour);// We add 22 hours to 00:00 GMT to make 22:00 GMT, which is 10 PM GMT, which is Forex week start time per ForexMarketHours.com.
Forex_WeekOpenTime_ThisBroker = GMT_Forex_WeekOpenTime + (Broker_GMTOffset*OneHour)+(DSTOffset*OneHour);// We add Broker GMT Offset to GMT Forex Week Open Time, plus 1 hour if broker adheres to Daylight Savings Time, to get the Forex Week Open Time for This Broker.
StartBar = iBarShift(NULL,0,Forex_WeekOpenTime_ThisBroker);
StartBarTime = iTime(NULL,0,StartBar);
if(StartBarTime < Forex_WeekOpenTime_ThisBroker) {
StartBar = iBarShift(NULL,0,Forex_WeekOpenTime_ThisBroker)-1;
StartBarTime = iTime(NULL,0,StartBar);
} else {
StartBar = iBarShift(NULL,0,Forex_WeekOpenTime_ThisBroker);
StartBarTime = iTime(NULL,0,StartBar);
}
if(Time[0] == StartBarTime && Bars > a) {
for(int m = Bars;m>=0;m--) {
ExtMapBuffer1[m] = 0;
ExtMapBuffer2[m] = 0;
ExtMapBuffer3[m] = 0;
ExtMapBuffer4[m] = 0;
ExtMapBuffer5[m] = 0;
ExtMapBuffer6[m] = 0;
ObjectsDeleteAll();
Comment("");
a=Bars;
}
}
if(ObjectFind("Start Time of Trades") == -1) {
ObjectCreate("Start Time of Trades",OBJ_VLINE,0,StartBarTime,0);
ObjectSet("Start Time of Trades",OBJPROP_COLOR,Green);
} else {
ObjectSet("Start Time of Trades",OBJPROP_TIME1,StartBarTime);
}
for(int j=0;j<6;j++) {
PairStartTime[j] = iTime(Pair[j],0,iBarShift(Pair[j],0,StartBarTime));
PairEndTime[j] = iTime(Pair[j],0,0);
}
EndTime = TimeCurrent();
for(int i=StartBar; i>=0; i--) {
DefineSpread();
for(j=0;j<6;j++) {
PairStartAsk[j] = iOpen(Pair[j],0,StartBar)+(PairSpread[j]*PairPip[j]);
PairStartBid[j] = iOpen(Pair[j],0,StartBar);
PairEndAsk[j] = iClose(Pair[j],0,i)+(PairSpread[j]*PairPip[j]);
PairEndBid[j] = iClose(Pair[j],0,i);
}
//For Buy pairs, subtract starting price (artificial Ask from start of week) from ending price (Bid now), then divide by 100 (if JPY pair), then multiply by 10000, to get pips gained or lost as whole numbers.
//For Sell pairs, subtract ending price (Ask now) from starting price (Bid from start of week), then divide by 100 (if JPY pair), then multiply by 10000, to get pips gained or lost as whole numbers.
for(j=0;j<3;j++) {
if( StringFind(Pair[j],"JPY",0)!=-1) {
Buys[j] = ((PairEndBid[j]-PairStartAsk[j])/100)*10000;
BuysIfSold[j] = ((PairStartBid[j]-PairEndAsk[j])/100)*10000;
} else {
Buys[j] = (PairEndBid[j]-PairStartAsk[j])*10000;
BuysIfSold[j] = (PairStartBid[j]-PairEndAsk[j])*10000;
}
}
for(j=3;j<6;j++) {
if( StringFind(Pair[j],"JPY",0)!=-1) {
Sells[j] = ((PairStartBid[j]-PairEndAsk[j])/100)*10000;
SellsIfBought[j] = ((PairEndBid[j]-PairStartAsk[j])/100)*10000;
} else {
Sells[j] = (PairStartBid[j]-PairEndAsk[j])*10000;
SellsIfBought[j] = (PairEndBid[j]-PairStartAsk[j])*10000;
}
}
if(MarketInfo(Symbol(),MODE_LOTSIZE) == 100000) LotsForIndis = 0.1;
else if(MarketInfo(Symbol(),MODE_LOTSIZE) == 10000) LotsForIndis = 1.0;
else if(MarketInfo(Symbol(),MODE_LOTSIZE) == 1000) LotsForIndis = 10.0;
if(UsePipCurrencyValue == True) {
DefinePipValuePerLotForEachPair();
for (j=0;j<6;j++) {
PairSpreadCost[j] = PairSpread[j]*PairPipValuePerLot[j]*LotsForIndis;
}
for(j=0;j<3;j++) {
Buys[j] = Buys[j]*PairPipValuePerLot[j]*LotsForIndis;
BuysIfSold[j] = BuysIfSold[j]*PairPipValuePerLot[j]*LotsForIndis;
}
for(j=3;j<6;j++) {
Sells[j] = Sells[j]*PairPipValuePerLot[j]*LotsForIndis;
SellsIfBought[j] = SellsIfBought[j]*PairPipValuePerLot[j]*LotsForIndis;
}
}
double sum_Buys=0;
double sum_BuysIfSold=0;
double sum_Sells=0;
double sum_SellsIfBought=0;
for(j=0;j<3;j++) {
sum_Buys = sum_Buys+Buys[j];
sum_BuysIfSold = sum_BuysIfSold+BuysIfSold[j];
}
for(j=3;j<6;j++) {
sum_Sells = sum_Sells+Sells[j];
sum_SellsIfBought = sum_SellsIfBought+SellsIfBought[j];
}
double sum_BuysSpread=0;
double sum_SellsSpread=0;
double sum_Spread=0;
for(j=0;j<3;j++) {
sum_BuysSpread = sum_BuysSpread+PairSpread[j];
}
for(j=3;j<6;j++) {
sum_SellsSpread = sum_SellsSpread+PairSpread[j];
}
for(j=0;j<6;j++) {
sum_Spread = sum_Spread+PairSpread[j];
}
if(ShowBuysLine == True) ExtMapBuffer1[i] = sum_Buys;
if(ShowSellsLine == True) ExtMapBuffer2[i] = sum_Sells;
if(ShowTotalLine == True) ExtMapBuffer3[i] = sum_Buys+sum_Sells;
if(ShowBuyAllLine == True) ExtMapBuffer4[i] = sum_Buys+sum_SellsIfBought;
if(ShowSellAllLine == True) ExtMapBuffer5[i] = sum_BuysIfSold+sum_Sells;
BuysSpreadCostTotal = PairSpreadCost[0]+PairSpreadCost[1]+PairSpreadCost[2]+PairSpreadCost[3];
SellsSpreadCostTotal = PairSpreadCost[4]+PairSpreadCost[5];
SpreadCostTotal = BuysSpreadCostTotal+SellsSpreadCostTotal;
//Make an array, that will keep all the most recent values (pips gained or lost) from the above calculations for each pair
ArrayInitialize(SortingArray,0.0);
//fill the first 3 places, 0-2, with Buy pairs' gains
for (j=0;j<3;j++) {
SortingArray[j] = Buys[j];
}
//fill the second 3 places, 3-5, with Sell pairs' gains
for (j=3;j<6;j++) {
SortingArray[j] = Sells[j];
}
//Sort the values in the array from most gain to most loss
ArraySort(SortingArray,WHOLE_ARRAY,0,MODE_DESCEND);
ReassociatePairsWithArray();
//Give color to those values (objects created below) depending on if a Buy Pair (BuyPairs_color) or Sell pair (SellPairs_color)
for(j=0;j<6;j++) {
if(Position[j] == Pair[0] || Position[j] == Pair[1] || Position[j] == Pair[2] || Position[j] == Pair[3]) {
PairColor[j] = BuyPairs_Color;
} else {
PairColor[j] = SellPairs_Color;
}
}
//Make strings of the above information to fill the Objects created below
if(UsePipCurrencyValue == False) {
int cvround = 0;
} else {
cvround = 2;
}
for (j=0;j<6;j++) {
PairValue[j] = DoubleToStr(SortingArray[j],cvround);
}
TotalProfitBuys = DoubleToStr(sum_Buys,2);
TotalProfitSells = DoubleToStr(sum_Sells,2);
TotalP_L = DoubleToStr(sum_Buys+sum_Sells,2);
IfBuyAll_Value = DoubleToStr(sum_Buys+sum_SellsIfBought,2);
IfSellAll_Value = DoubleToStr(sum_BuysIfSold+sum_Sells,2);
}
if(ShowTotalLine == True) {
if(StartBar > 20) StartBar -= 20;
//Do the Moving Average
for(i = StartBar; i >= 0; i--) {
ExtMapBuffer6[i] = iMAOnArray(ExtMapBuffer3,0,20,0,MODE_LWMA,i);
}
}
if(StrToDouble(TotalProfitBuys) > 0) TotalProfitBuysColor = Positive_Color;
else if(StrToDouble(TotalProfitBuys) < 0) TotalProfitBuysColor = Negative_Color;
else if(StrToDouble(TotalProfitBuys) == 0) TotalProfitBuysColor = White;
if(StrToDouble(TotalProfitSells) > 0) TotalProfitSellsColor = Positive_Color;
else if(StrToDouble(TotalProfitSells) < 0) TotalProfitSellsColor = Negative_Color;
else if(StrToDouble(TotalProfitSells) == 0) TotalProfitSellsColor = White;
if(StrToDouble(IfBuyAll_Value) > 0) TotalProfitBuyAllColor = Positive_Color;
else if(StrToDouble(IfBuyAll_Value) < 0) TotalProfitBuyAllColor = Negative_Color;
else if(StrToDouble(IfBuyAll_Value) == 0) TotalProfitBuyAllColor = White;
if(StrToDouble(IfSellAll_Value) > 0) TotalProfitSellAllColor = Positive_Color;
else if(StrToDouble(IfSellAll_Value) < 0) TotalProfitSellAllColor = Negative_Color;
else if(StrToDouble(IfSellAll_Value) == 0) TotalProfitSellAllColor = White;
if(ShowComments == True) {
ShowCommentsThen();
}
if(DrawObjects == True) {
DrawObjectsThen();
}
if(LastBid != ExtMapBuffer4[0]) LastBid = ExtMapBuffer4[0];
//----
return(0);
}
//+------------------------------------------------------------------+
void ChooseT101PairSet() {
Pair_Suffix=StringSubstr(Symbol(),6,StringLen(Symbol())-6);
Pair[0] = "EURJPY"+Pair_Suffix;
Pair[1] = "USDCHF"+Pair_Suffix;
Pair[2] = "GBPUSD"+Pair_Suffix;
Pair[3] = "EURUSD"+Pair_Suffix;
Pair[4] = "USDJPY"+Pair_Suffix;
Pair[5] = "GBPCHF"+Pair_Suffix;
return;
}
void DefinePipForEachPair() {
for(int j=0;j<6;j++) {
if(Point == 0.0001 || Point == 0.01) {
PairPip[j] = MarketInfo(Pair[j],MODE_POINT);
} else if(Point == 0.00001 || Point == 0.001) {
PairPip[j] = MarketInfo(Pair[j],MODE_POINT)*10;
}
}
return;
}
void DefineSpread() {
if(UseSpread == True) {
for(int j=0;j<6;j++) {
if(Point == 0.00001 || Point == 0.001) {
PairSpread[j] = NormalizeDouble(MarketInfo(Pair[j],MODE_SPREAD)/10,1);
} else if(Point == 0.0001 || Point == 0.01) {
PairSpread[j] = NormalizeDouble(MarketInfo(Pair[j],MODE_SPREAD),0);
}
}
} else {
for(j=0;j<6;j++) {
PairSpread[j] = 0;
}
}
return;
}
void DefinePipValuePerLotForEachPair() {
for(int j=0;j<6;j++) {
if(Point == 0.0001 || Point == 0.01) {
PairPipValuePerLot[j] = MarketInfo(Pair[j], MODE_TICKVALUE);
} else if(Point == 0.00001 || Point == 0.001) {
PairPipValuePerLot[j] = MarketInfo(Pair[j], MODE_TICKVALUE)*10;
}
}
return;
}
void ShowCommentsThen() {
if((PairEndTime[0]+(Period()*60)-60) > TimeCurrent()) PairEndTime[0] = TimeCurrent();
else PairEndTime[0] = (PairEndTime[0]+(Period()*60)-60);
for(int j=0;j<6;j++) {
digits[j] = MarketInfo(Pair[j],MODE_DIGITS);
}
Comment(
"---------------------------------------" + "n" +
"For real GMT Time, check: http://wwp.greenwichmeantime.com/" + "n" +
"User inputs are correct if real GMT Time is: " + TimeToStr(GMT_Time) + "n" +
"Broker GMT Offset = " + Broker_GMTOffset + " (user input)" + "n" +
"On Daylight Savings Time = " + OnDaylightSavingsTime + " (user input)" + "n" +
"---------------------------------------" + "n" +
"Broker Server Time Now = " + TimeToStr(TimeCurrent()) + "n" +
"---------------------------------------" + "n" +
"Forex Week Open Time In GMT Time = " + TimeToStr(GMT_Forex_WeekOpenTime) + "n" +
"Forex Week Open Time On This Broker = " + TimeToStr(Forex_WeekOpenTime_ThisBroker) + "n" +
"StartBar = " + StartBar + "n" +
"---------------------------------------" + "n" +
Pair[0]+": " + "Open Bar Open Time = " + TimeToStr(PairStartTime[0]) + ", Open Price (faux Ask) = " + DoubleToStr(PairStartAsk[0],digits[0]) + ", Close Bar Close Time = " + TimeToStr(PairEndTime[0]) + ", Close Price (Bid) = " + DoubleToStr(PairEndBid[0],digits[0]) + ", Pair Gain/Loss = " + DoubleToStr(Buys[0],2) + ", Spread = " + DoubleToStr(PairSpread[0],0) + "n" +
Pair[1]+": " + "Open Bar Open Time = " + TimeToStr(PairStartTime[1]) + ", Open Price (faux Ask) = " + DoubleToStr(PairStartAsk[1],digits[1]) + ", Close Bar Close Time = " + TimeToStr(PairEndTime[0]) + ", Close Price (Bid) = " + DoubleToStr(PairEndBid[1],digits[1]) + ", Pair Gain/Loss = " + DoubleToStr(Buys[1],2) + ", Spread = " + DoubleToStr(PairSpread[1],0) + "n" +
Pair[2]+": " + "Open Bar Open Time = " + TimeToStr(PairStartTime[2]) + ", Open Price (faux Ask) = " + DoubleToStr(PairStartAsk[2],digits[2]) + ", Close Bar Close Time = " + TimeToStr(PairEndTime[0]) + ", Close Price (Bid) = " + DoubleToStr(PairEndBid[2],digits[2]) + ", Pair Gain/Loss = " + DoubleToStr(Buys[2],2) + ", Spread = " + DoubleToStr(PairSpread[2],0) + "n" +
"------------------------------------" + "n" +
Pair[4]+": " + "Open Bar Open Time = " + TimeToStr(PairStartTime[4]) + ", Open Price (Bid) = " + DoubleToStr(PairStartBid[4],digits[4]) + ", Close Bar Close Time = " + TimeToStr(PairEndTime[0]) + ", Close Price (Ask) = " + DoubleToStr(PairEndAsk[4],digits[4]) + ", Pair Gain/Loss = " + DoubleToStr(Sells[4],2) + ", Spread = " + DoubleToStr(PairSpread[4],0) + "n" +
Pair[5]+": " + "Open Bar Open Time = " + TimeToStr(PairStartTime[5]) + ", Open Price (Bid) = " + DoubleToStr(PairStartBid[5],digits[5]) + ", Close Bar Close Time = " + TimeToStr(PairEndTime[0]) + ", Close Price (Ask) = " + DoubleToStr(PairEndAsk[5],digits[5]) + ", Pair Gain/Loss = " + DoubleToStr(Sells[5],2) + ", Spread = " + DoubleToStr(PairSpread[5],0) + "n" +
Pair[6]+": " + "Open Bar Open Time = " + TimeToStr(PairStartTime[6]) + ", Open Price (Bid) = " + DoubleToStr(PairStartBid[6],digits[6]) + ", Close Bar Close Time = " + TimeToStr(PairEndTime[0]) + ", Close Price (Ask) = " + DoubleToStr(PairEndAsk[6],digits[6]) + ", Pair Gain/Loss = " + DoubleToStr(Sells[6],2) + ", Spread = " + DoubleToStr(PairSpread[6],0) + "n" +
"------------------------------------" + "n" +
"Buys Profit = " + DoubleToStr(ExtMapBuffer1[0],2) + "n" +
"Sells Profit = " + DoubleToStr(ExtMapBuffer2[0],2) + "n" +
"Buys and Sells Total Profit = " + DoubleToStr(ExtMapBuffer3[0],2) + "n" +
"LastBid = " + DoubleToStr(LastBid,2) + "n" +
"Total Profit If Buying All = " + DoubleToStr(ExtMapBuffer4[0],2) + "n" +
"Total Profit If Selling All = " + DoubleToStr(ExtMapBuffer5[0],2)
);
return;
}
void ReassociatePairsWithArray() { //Re-associate the values in the array with the pairs the values belong to
if(SortingArray[0] == Buys[0]) {
Position[0] = Pair[0];
} else if(SortingArray[0] == Buys[1]) {
Position[0] = Pair[1];
} else if(SortingArray[0] == Buys[2]) {
Position[0] = Pair[2];
} else if(SortingArray[0] == Buys[3]) {
Position[0] = Pair[3];
} else if(SortingArray[0] == Sells[4]) {
Position[0] = Pair[4];
} else if(SortingArray[0] == Sells[5]) {
Position[0] = Pair[5];
}
if(SortingArray[1] == Buys[0]) {
Position[1] = Pair[0];
} else if(SortingArray[1] == Buys[1]) {
Position[1] = Pair[1];
} else if(SortingArray[1] == Buys[2]) {
Position[1] = Pair[2];
} else if(SortingArray[1] == Buys[3]) {
Position[1] = Pair[3];
} else if(SortingArray[1] == Sells[4]) {
Position[1] = Pair[4];
} else if(SortingArray[1] == Sells[5]) {
Position[1] = Pair[5];
}
if(SortingArray[2] == Buys[0]) {
Position[2] = Pair[0];
} else if(SortingArray[2] == Buys[1]) {
Position[2] = Pair[1];
} else if(SortingArray[2] == Buys[2]) {
Position[2] = Pair[2];
} else if(SortingArray[2] == Buys[3]) {
Position[2] = Pair[3];
} else if(SortingArray[2] == Sells[4]) {
Position[2] = Pair[4];
} else if(SortingArray[2] == Sells[5]) {
Position[2] = Pair[5];
}
if(SortingArray[3] == Buys[0]) {
Position[3] = Pair[0];
} else if(SortingArray[3] == Buys[1]) {
Position[3] = Pair[1];
} else if(SortingArray[3] == Buys[2]) {
Position[3] = Pair[2];
} else if(SortingArray[3] == Buys[3]) {
Position[3] = Pair[3];
} else if(SortingArray[3] == Sells[4]) {
Position[3] = Pair[4];
} else if(SortingArray[3] == Sells[5]) {
Position[3] = Pair[5];
}
if(SortingArray[4] == Buys[0]) {
Position[4] = Pair[0];
} else if(SortingArray[4] == Buys[1]) {
Position[4] = Pair[1];
} else if(SortingArray[4] == Buys[2]) {
Position[4] = Pair[2];
} else if(SortingArray[4] == Buys[3]) {
Position[4] = Pair[3];
} else if(SortingArray[4] == Sells[4]) {
Position[4] = Pair[4];
} else if(SortingArray[4] == Sells[5]) {
Position[4] = Pair[5];
}
if(SortingArray[5] == Buys[0]) {
Position[5] = Pair[0];
} else if(SortingArray[5] == Buys[1]) {
Position[5] = Pair[1];
} else if(SortingArray[5] == Buys[2]) {
Position[5] = Pair[2];
} else if(SortingArray[5] == Buys[3]) {
Position[5] = Pair[3];
} else if(SortingArray[5] == Sells[4]) {
Position[5] = Pair[4];
} else if(SortingArray[5] == Sells[5]) {
Position[5] = Pair[5];
}
if(SortingArray[6] == Buys[0]) {
Position[6] = Pair[0];
} else if(SortingArray[6] == Buys[1]) {
Position[6] = Pair[1];
} else if(SortingArray[6] == Buys[2]) {
Position[6] = Pair[2];
} else if(SortingArray[6] == Buys[3]) {
Position[6] = Pair[3];
} else if(SortingArray[6] == Sells[4]) {
Position[6] = Pair[4];
} else if(SortingArray[6] == Sells[5]) {
Position[6] = Pair[5];
}
if(SortingArray[7] == Buys[0]) {
Position[7] = Pair[0];
} else if(SortingArray[7] == Buys[1]) {
Position[7] = Pair[1];
} else if(SortingArray[7] == Buys[2]) {
Position[7] = Pair[2];
} else if(SortingArray[7] == Buys[3]) {
Position[7] = Pair[3];
} else if(SortingArray[7] == Sells[4]) {
Position[7] = Pair[4];
} else if(SortingArray[7] == Sells[5]) {
Position[7] = Pair[5];
}
return;
}
void DrawObjectsThen() {
//ObjectsDeleteAll();
ObjectCreate(shortname + "50", OBJ_LABEL, 0, 0, 0);
ObjectSetText(shortname + "50"," StartTime:"+TimeToStr(PairStartTime[0]),7, "Arial Bold", White);
ObjectSet(shortname + "50", OBJPROP_CORNER, 0);
ObjectSet(shortname + "50", OBJPROP_XDISTANCE, 10+myXoffset);
ObjectSet(shortname + "50", OBJPROP_YDISTANCE, 0+myYoffset);
ObjectCreate(shortname + "51", OBJ_LABEL, 0, 0, 0);
ObjectSetText(shortname + "51"," EndTime:"+TimeToStr(PairEndTime[0]),7, "Arial Bold", White);
ObjectSet(shortname + "51", OBJPROP_CORNER, 0);
ObjectSet(shortname + "51", OBJPROP_XDISTANCE, 10+myXoffset);
ObjectSet(shortname + "51", OBJPROP_YDISTANCE, 12+myYoffset);
ObjectCreate(shortname + "3", OBJ_LABEL, 0, 0, 0);
ObjectSetText(shortname + "3",StringSubstr(Position[0],0),12, "Arial Bold", PairColor[0]);
ObjectSet(shortname + "3", OBJPROP_CORNER, 0);
ObjectSet(shortname + "3", OBJPROP_XDISTANCE, 10+myXoffset);
ObjectSet(shortname + "3", OBJPROP_YDISTANCE, 25+myYoffset);
if(ShowIndividualGainsLosses == True) {
ObjectCreate(shortname + "4", OBJ_LABEL, 0, 0, 0);
ObjectSetText(shortname + "4",StringSubstr(PairValue[0],0),12, "Arial Bold", PairColor[0]);
ObjectSet(shortname + "4", OBJPROP_CORNER, 0);
ObjectSet(shortname + "4", OBJPROP_XDISTANCE, 105+myXoffset);
ObjectSet(shortname + "4", OBJPROP_YDISTANCE, 25+myYoffset);
}
ObjectCreate(shortname + "5", OBJ_LABEL, 0, 0, 0);
ObjectSetText(shortname + "5",StringSubstr(Position[1],0),12, "Arial Bold", PairColor[1]);
ObjectSet(shortname + "5", OBJPROP_CORNER, 0);
ObjectSet(shortname + "5", OBJPROP_XDISTANCE, 10+myXoffset);
ObjectSet(shortname + "5", OBJPROP_YDISTANCE, 40+myYoffset);
if(ShowIndividualGainsLosses == True) {
ObjectCreate(shortname + "6", OBJ_LABEL, 0, 0, 0);
ObjectSetText(shortname + "6",StringSubstr(PairValue[1],0),12, "Arial Bold", PairColor[1]);
ObjectSet(shortname + "6", OBJPROP_CORNER, 0);
ObjectSet(shortname + "6", OBJPROP_XDISTANCE, 105+myXoffset);
ObjectSet(shortname + "6", OBJPROP_YDISTANCE, 40+myYoffset);
}
ObjectCreate(shortname + "7", OBJ_LABEL, 0, 0, 0);
ObjectSetText(shortname + "7",StringSubstr(Position[2],0),12, "Arial Bold", PairColor[2]);
ObjectSet(shortname + "7", OBJPROP_CORNER, 0);
ObjectSet(shortname + "7", OBJPROP_XDISTANCE, 10+myXoffset);
ObjectSet(shortname + "7", OBJPROP_YDISTANCE, 55+myYoffset);
if(ShowIndividualGainsLosses == True) {
ObjectCreate(shortname + "8", OBJ_LABEL, 0, 0, 0);
ObjectSetText(shortname + "8",StringSubstr(PairValue[2],0),12, "Arial Bold", PairColor[2]);
ObjectSet(shortname + "8", OBJPROP_CORNER, 0);
ObjectSet(shortname + "8", OBJPROP_XDISTANCE, 105+myXoffset);
ObjectSet(shortname + "8", OBJPROP_YDISTANCE, 55+myYoffset);
}
ObjectCreate(shortname + "9", OBJ_LABEL, 0, 0, 0);
ObjectSetText(shortname + "9",StringSubstr(Position[3],0),12, "Arial Bold", PairColor[3]);
ObjectSet(shortname + "9", OBJPROP_CORNER, 0);
ObjectSet(shortname + "9", OBJPROP_XDISTANCE, 10+myXoffset);
ObjectSet(shortname + "9", OBJPROP_YDISTANCE, 70+myYoffset);
if(ShowIndividualGainsLosses == True) {
ObjectCreate(shortname + "10", OBJ_LABEL, 0, 0, 0);
ObjectSetText(shortname + "10",StringSubstr(PairValue[3],0),12, "Arial Bold", PairColor[3]);
ObjectSet(shortname + "10", OBJPROP_CORNER, 0);
ObjectSet(shortname + "10", OBJPROP_XDISTANCE, 105+myXoffset);
ObjectSet(shortname + "10", OBJPROP_YDISTANCE, 70+myYoffset);
}
if(ShowIndividualGainsLosses == False) {
ObjectCreate(shortname + "49", OBJ_LABEL, 0, 0, 0);
ObjectSetText(shortname + "49","--------------",12, "Arial Bold", White);
ObjectSet(shortname + "49", OBJPROP_CORNER, 0);
ObjectSet(shortname + "49", OBJPROP_XDISTANCE, 10+myXoffset);
ObjectSet(shortname + "49", OBJPROP_YDISTANCE, 75+myYoffset);
} else if(ShowIndividualGainsLosses == True) {
ObjectCreate(shortname + "49", OBJ_LABEL, 0, 0, 0);
ObjectSetText(shortname + "49","------------------------------",12, "Arial Bold", White);
ObjectSet(shortname + "49", OBJPROP_CORNER, 0);
ObjectSet(shortname + "49", OBJPROP_XDISTANCE, 10+myXoffset);
ObjectSet(shortname + "49", OBJPROP_YDISTANCE, 75+myYoffset);
}
ObjectCreate(shortname + "11", OBJ_LABEL, 0, 0, 0);
ObjectSetText(shortname + "11",StringSubstr(Position[4],0),12, "Arial Bold", PairColor[4]);
ObjectSet(shortname + "11", OBJPROP_CORNER, 0);
ObjectSet(shortname + "11", OBJPROP_XDISTANCE, 10+myXoffset);
ObjectSet(shortname + "11", OBJPROP_YDISTANCE, 85+myYoffset);
if(ShowIndividualGainsLosses == True) {
ObjectCreate(shortname + "12", OBJ_LABEL, 0, 0, 0);
ObjectSetText(shortname + "12",StringSubstr(PairValue[4],0),12, "Arial Bold", PairColor[4]);
ObjectSet(shortname + "12", OBJPROP_CORNER, 0);
ObjectSet(shortname + "12", OBJPROP_XDISTANCE, 105+myXoffset);
ObjectSet(shortname + "12", OBJPROP_YDISTANCE, 85+myYoffset);
}
ObjectCreate(shortname + "13", OBJ_LABEL, 0, 0, 0);
ObjectSetText(shortname + "13",StringSubstr(Position[5],0),12, "Arial Bold", PairColor[5]);
ObjectSet(shortname + "13", OBJPROP_CORNER, 0);
ObjectSet(shortname + "13", OBJPROP_XDISTANCE, 10+myXoffset);
ObjectSet(shortname + "13", OBJPROP_YDISTANCE, 100+myYoffset);
if(ShowIndividualGainsLosses == True) {
ObjectCreate(shortname + "14", OBJ_LABEL, 0, 0, 0);
ObjectSetText(shortname + "14",StringSubstr(PairValue[5],0),12, "Arial Bold", PairColor[5]);
ObjectSet(shortname + "14", OBJPROP_CORNER, 0);
ObjectSet(shortname + "14", OBJPROP_XDISTANCE, 105+myXoffset);
ObjectSet(shortname + "14", OBJPROP_YDISTANCE, 100+myYoffset);
}
ObjectCreate(shortname + "15", OBJ_LABEL, 0, 0, 0);
ObjectSetText(shortname + "15",StringSubstr(Position[6],0),12, "Arial Bold", PairColor[6]);
ObjectSet(shortname + "15", OBJPROP_CORNER, 0);
ObjectSet(shortname + "15", OBJPROP_XDISTANCE, 10+myXoffset);
ObjectSet(shortname + "15", OBJPROP_YDISTANCE, 115+myYoffset);
if(ShowIndividualGainsLosses == True) {
ObjectCreate(shortname + "16", OBJ_LABEL, 0, 0, 0);
ObjectSetText(shortname + "16",StringSubstr(PairValue[6],0),12, "Arial Bold", PairColor[6]);
ObjectSet(shortname + "16", OBJPROP_CORNER, 0);
ObjectSet(shortname + "16", OBJPROP_XDISTANCE, 105+myXoffset);
ObjectSet(shortname + "16", OBJPROP_YDISTANCE, 115+myYoffset);
}
ObjectCreate(shortname + "17", OBJ_LABEL, 0, 0, 0);
ObjectSetText(shortname + "17",StringSubstr(Position[7],0),12, "Arial Bold", PairColor[7]);
ObjectSet(shortname + "17", OBJPROP_CORNER, 0);
ObjectSet(shortname + "17", OBJPROP_XDISTANCE, 10+myXoffset);
ObjectSet(shortname + "17", OBJPROP_YDISTANCE, 130+myYoffset);
if(ShowIndividualGainsLosses == True) {
ObjectCreate(shortname + "18", OBJ_LABEL, 0, 0, 0);
ObjectSetText(shortname + "18",StringSubstr(PairValue[7],0),12, "Arial Bold", PairColor[7]);
ObjectSet(shortname + "18", OBJPROP_CORNER, 0);
ObjectSet(shortname + "18", OBJPROP_XDISTANCE, 105+myXoffset);
ObjectSet(shortname + "18", OBJPROP_YDISTANCE, 130+myYoffset);
}
ObjectCreate(shortname + "31", OBJ_LABEL, 0, 0, 0);
ObjectSetText(shortname + "31",StringSubstr("Buys Profit",0),12, "Arial Bold", White);
ObjectSet(shortname + "31", OBJPROP_CORNER, 0);
ObjectSet(shortname + "31", OBJPROP_XDISTANCE, 10+myXoffset);
ObjectSet(shortname + "31", OBJPROP_YDISTANCE, 150+myYoffset);
ObjectCreate(shortname + "32", OBJ_LABEL, 0, 0, 0);
ObjectSetText(shortname + "32",StringSubstr(TotalProfitBuys,0),12, "Arial Bold", TotalProfitBuysColor);
ObjectSet(shortname + "32", OBJPROP_CORNER, 0);
ObjectSet(shortname + "32", OBJPROP_XDISTANCE, 105+myXoffset);
ObjectSet(shortname + "32", OBJPROP_YDISTANCE, 150+myYoffset);
ObjectCreate(shortname + "33", OBJ_LABEL, 0, 0, 0);
ObjectSetText(shortname + "33",StringSubstr("Sells Profit",0),12, "Arial Bold", White);
ObjectSet(shortname + "33", OBJPROP_CORNER, 0);
ObjectSet(shortname + "33", OBJPROP_XDISTANCE, 10+myXoffset);
ObjectSet(shortname + "33", OBJPROP_YDISTANCE, 165+myYoffset);
ObjectCreate(shortname + "34", OBJ_LABEL, 0, 0, 0);
ObjectSetText(shortname + "34",StringSubstr(TotalProfitSells,0),12, "Arial Bold", TotalProfitSellsColor);
ObjectSet(shortname + "34", OBJPROP_CORNER, 0);
ObjectSet(shortname + "34", OBJPROP_XDISTANCE, 105+myXoffset);
ObjectSet(shortname + "34", OBJPROP_YDISTANCE, 165+myYoffset);
ObjectCreate(shortname + "35", OBJ_LABEL, 0, 0, 0);
ObjectSetText(shortname + "35",StringSubstr("Total P/L",0),12, "Arial Bold", White);
ObjectSet(shortname + "35", OBJPROP_CORNER, 0);
ObjectSet(shortname + "35", OBJPROP_XDISTANCE, 10+myXoffset);
ObjectSet(shortname + "35", OBJPROP_YDISTANCE, 180+myYoffset);
ObjectCreate(shortname + "36", OBJ_LABEL, 0, 0, 0);
ObjectSetText(shortname + "36",StringSubstr(TotalP_L,0),12, "Arial Bold", White);
ObjectSet(shortname + "36", OBJPROP_CORNER, 0);
ObjectSet(shortname + "36", OBJPROP_XDISTANCE, 105+myXoffset);
ObjectSet(shortname + "36", OBJPROP_YDISTANCE, 180+myYoffset);
ObjectCreate(shortname + "39", OBJ_LABEL, 0, 0, 0);
ObjectSetText(shortname + "39",StringSubstr("Buys Spread",0),12, "Arial Bold", White);
ObjectSet(shortname + "39", OBJPROP_CORNER, 0);
ObjectSet(shortname + "39", OBJPROP_XDISTANCE, 10+myXoffset);
ObjectSet(shortname + "39", OBJPROP_YDISTANCE, 195+myYoffset);
ObjectCreate(shortname + "40", OBJ_LABEL, 0, 0, 0);
ObjectSetText(shortname + "40",DoubleToStr(BuysSpreadCostTotal,2),12, "Arial Bold", White);
ObjectSet(shortname + "40", OBJPROP_CORNER, 0);
ObjectSet(shortname + "40", OBJPROP_XDISTANCE, 105+myXoffset);
ObjectSet(shortname + "40", OBJPROP_YDISTANCE, 195+myYoffset);
ObjectCreate(shortname + "41", OBJ_LABEL, 0, 0, 0);
ObjectSetText(shortname + "41",StringSubstr("Sells Spread",0),12, "Arial Bold", White);
ObjectSet(shortname + "41", OBJPROP_CORNER, 0);
ObjectSet(shortname + "41", OBJPROP_XDISTANCE, 10+myXoffset);
ObjectSet(shortname + "41", OBJPROP_YDISTANCE, 210+myYoffset);
ObjectCreate(shortname + "42", OBJ_LABEL, 0, 0, 0);
ObjectSetText(shortname + "42",DoubleToStr(SellsSpreadCostTotal,2),12, "Arial Bold", White);
ObjectSet(shortname + "42", OBJPROP_CORNER, 0);
ObjectSet(shortname + "42", OBJPROP_XDISTANCE, 105+myXoffset);
ObjectSet(shortname + "42", OBJPROP_YDISTANCE, 210+myYoffset);
ObjectCreate(shortname + "43", OBJ_LABEL, 0, 0, 0);
ObjectSetText(shortname + "43",StringSubstr("Total Spread",0),12, "Arial Bold", White);
ObjectSet(shortname + "43", OBJPROP_CORNER, 0);
ObjectSet(shortname + "43", OBJPROP_XDISTANCE, 10+myXoffset);
ObjectSet(shortname + "43", OBJPROP_YDISTANCE, 225+myYoffset);
ObjectCreate(shortname + "44", OBJ_LABEL, 0, 0, 0);
ObjectSetText(shortname + "44",DoubleToStr(SpreadCostTotal,2),12, "Arial Bold", White);
ObjectSet(shortname + "44", OBJPROP_CORNER, 0);
ObjectSet(shortname + "44", OBJPROP_XDISTANCE, 105+myXoffset);
ObjectSet(shortname + "44", OBJPROP_YDISTANCE, 225+myYoffset);
ObjectCreate(shortname + "45", OBJ_LABEL, 0, 0, 0);
ObjectSetText(shortname + "45",StringSubstr("Buy All P/L",0),12, "Arial Bold", White);
ObjectSet(shortname + "45", OBJPROP_CORNER, 0);
ObjectSet(shortname + "45", OBJPROP_XDISTANCE, 10+myXoffset);
ObjectSet(shortname + "45", OBJPROP_YDISTANCE, 240+myYoffset);
ObjectCreate(shortname + "46", OBJ_LABEL, 0, 0, 0);
ObjectSetText(shortname + "46",IfBuyAll_Value,12, "Arial Bold", TotalProfitBuyAllColor);
ObjectSet(shortname + "46", OBJPROP_CORNER, 0);
ObjectSet(shortname + "46", OBJPROP_XDISTANCE, 105+myXoffset);
ObjectSet(shortname + "46", OBJPROP_YDISTANCE, 240+myYoffset);
ObjectCreate(shortname + "47", OBJ_LABEL, 0, 0, 0);
ObjectSetText(shortname + "47",StringSubstr("Sell All P/L ",0),12, "Arial Bold", White);
ObjectSet(shortname + "47", OBJPROP_CORNER, 0);
ObjectSet(shortname + "47", OBJPROP_XDISTANCE, 10+myXoffset);
ObjectSet(shortname + "47", OBJPROP_YDISTANCE, 255+myYoffset);
ObjectCreate(shortname + "48", OBJ_LABEL, 0, 0, 0);
ObjectSetText(shortname + "48",IfSellAll_Value,12, "Arial Bold", TotalProfitSellAllColor);
ObjectSet(shortname + "48", OBJPROP_CORNER, 0);
ObjectSet(shortname + "48", OBJPROP_XDISTANCE, 105+myXoffset);
ObjectSet(shortname + "48", OBJPROP_YDISTANCE, 255+myYoffset);
return;
}
#include <zznbrm.datetime.mqh> //zznbrm
Thanks
I need to have 3 buys and 3 sell pairs.
They are
Buys:
EURJPY
USDCHF
GBPUSD
Sells:
EURUSD
USDJPY
GBPCHF
#property indicator_separate_window
#property indicator_buffers 6
#property indicator_color1 Green
#property indicator_color2 Red
#property indicator_color3 DeepSkyBlue
#property indicator_color4 LightGreen
#property indicator_color5 Orange
#property indicator_color6 Yellow
extern bool ShowComments = False;
extern int Xoffset = 0;
extern int Yoffset = 20;
extern string BGMTO = "Broker GMT Offset";
extern string inst = "Set once during non-Daylight Savings Time";
extern int Broker_GMTOffset = -5;
extern string inst2 = "Set Daylight Savings Time twice per year";
extern bool OnDaylightSavingsTime = True;
extern bool UseSpread = True;
extern bool UsePipCurrencyValue = True;
int StartWeeksBack = 0;
extern bool ShowBuysLine = False;
extern bool ShowSellsLine = False;
extern bool ShowTotalLine = True;
extern bool ShowBuyAllLine = False;
extern bool ShowSellAllLine = False;
extern bool DrawObjects = True;
extern color BuyPairs_Color = DeepSkyBlue;
extern color SellPairs_Color = Red;
extern color Positive_Color = DeepSkyBlue;
extern color Negative_Color = Red;
extern bool ShowIndividualGainsLosses = True;
string Pair_Suffix = "",shortname;
int GMTStartHour,BrokerStartHour,StartBar,myXoffset,myYoffset,a=0;
datetime GMT_Time,StartBarOpenTime,Broker_WeekOpenTime,GMT_Forex_WeekOpenTime,Forex_WeekOpenTime_ThisBroker,StartBarTime,EndTime;
bool BuyAllAlertDone,SellAllAlertDone,ExitBuyAlertDone,ExitSellAlertDone;
string TotalProfitBuys,TotalProfitSells,TotalP_L,IfBuyAll_Value,IfSellAll_Value;
color TotalProfitBuysColor,TotalProfitSellsColor,TotalProfitBuyAllColor,TotalProfitSellAllColor;
double BuysSpreadCostTotal,SellsSpreadCostTotal,SpreadCostTotal,LotsForIndis,LastBid;
int BrokerTZ; //zznbrm
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];
double ExtMapBuffer5[];
double ExtMapBuffer6[];
string Pair[6];
double PairPip[6];
double PairSpread[6];
double PairPipValuePerLot[6];
double PairSpreadCost[6];
datetime PairStartTime[6];
double PairStartAsk[6];
double PairStartBid[6];
datetime PairEndTime[6];
double PairEndAsk[6];
double PairEndBid[6];
double Buys[6];
double Sells[6];
double BuysIfSold[6];
double SellsIfBought[6];
double SortingArray[6];
color PairColor[6];
string Position[6];
string PairValue[6];
int digits[6];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
SetLevelValue(0,0);
shortname="T101 IA indi";
IndicatorShortName(shortname);
SetIndexStyle(0,DRAW_LINE);
SetIndexLabel (0, "Buys");
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexStyle(1,DRAW_LINE);
SetIndexLabel (1, "Sells");
SetIndexBuffer(1,ExtMapBuffer2);
SetIndexStyle(2,DRAW_LINE);
SetIndexLabel (2, "Buys and Sells Total");
SetIndexBuffer(2,ExtMapBuffer3);
SetIndexStyle(3,DRAW_LINE);
SetIndexLabel (3, "Total If Buying All");
SetIndexBuffer(3,ExtMapBuffer4);
SetIndexStyle(4,DRAW_LINE);
SetIndexLabel (4, "Total If Selling All");
SetIndexBuffer(4,ExtMapBuffer5);
SetIndexStyle(5,DRAW_LINE);
SetIndexLabel (5, "20 LWMA on Buys and Sells Total");
SetIndexBuffer(5,ExtMapBuffer6);
BrokerTZ = getBrokerTZ(); //zznbrm
ChooseT101PairSet();
DefinePipForEachPair();
//----
return(0);
}
//----
int deinit() {
ObjectsDeleteAll(0);
Comment("");
return(0);
}
//+------------------------------------------------------------------+
//| Accumulation/Distribution |
//+------------------------------------------------------------------+
int start()
{
/*
for(j=0;j<6;j++) {
PairStartTime[j] = iTime(Pair[j],0,iBarShift(Pair[j],0,StartBarTime));
}
*/
if(ShowComments == False) {
myXoffset = Xoffset+0;
myYoffset = Yoffset+0;
} else if(ShowComments == True) {
myXoffset = Xoffset+850;
myYoffset = Yoffset+0;
}
//For comments, to make sure Broker_GMTOffset is correct
if(OnDaylightSavingsTime == True) {
GMT_Time = (TimeCurrent()+(((-Broker_GMTOffset)-1)*60*60));
} else {
GMT_Time = (TimeCurrent()+((-Broker_GMTOffset)*60*60));
}
int OneSecond = 1;
int OneMinute = 60*OneSecond;
int OneHour = 60*OneMinute;
if(OnDaylightSavingsTime == True) {
int DSTOffset = 1;
} else {
DSTOffset = 0;
}
//From http://www.forexmarkethours.com/ :
//Forex market welcomes traders 24 hours a day.
//Forex market opens on Sunday 5 pm EST (10:00 pm GMT), closes on Friday 5 pm EST (10:00 pm GMT).
Broker_WeekOpenTime = calcWeekStart( TimeCurrent(), BrokerTZ ); //zznbrm
GMT_Forex_WeekOpenTime = Broker_WeekOpenTime+((22-TimeHour(Broker_WeekOpenTime))*OneHour);// We add 22 hours to 00:00 GMT to make 22:00 GMT, which is 10 PM GMT, which is Forex week start time per ForexMarketHours.com.
Forex_WeekOpenTime_ThisBroker = GMT_Forex_WeekOpenTime + (Broker_GMTOffset*OneHour)+(DSTOffset*OneHour);// We add Broker GMT Offset to GMT Forex Week Open Time, plus 1 hour if broker adheres to Daylight Savings Time, to get the Forex Week Open Time for This Broker.
StartBar = iBarShift(NULL,0,Forex_WeekOpenTime_ThisBroker);
StartBarTime = iTime(NULL,0,StartBar);
if(StartBarTime < Forex_WeekOpenTime_ThisBroker) {
StartBar = iBarShift(NULL,0,Forex_WeekOpenTime_ThisBroker)-1;
StartBarTime = iTime(NULL,0,StartBar);
} else {
StartBar = iBarShift(NULL,0,Forex_WeekOpenTime_ThisBroker);
StartBarTime = iTime(NULL,0,StartBar);
}
if(Time[0] == StartBarTime && Bars > a) {
for(int m = Bars;m>=0;m--) {
ExtMapBuffer1[m] = 0;
ExtMapBuffer2[m] = 0;
ExtMapBuffer3[m] = 0;
ExtMapBuffer4[m] = 0;
ExtMapBuffer5[m] = 0;
ExtMapBuffer6[m] = 0;
ObjectsDeleteAll();
Comment("");
a=Bars;
}
}
if(ObjectFind("Start Time of Trades") == -1) {
ObjectCreate("Start Time of Trades",OBJ_VLINE,0,StartBarTime,0);
ObjectSet("Start Time of Trades",OBJPROP_COLOR,Green);
} else {
ObjectSet("Start Time of Trades",OBJPROP_TIME1,StartBarTime);
}
for(int j=0;j<6;j++) {
PairStartTime[j] = iTime(Pair[j],0,iBarShift(Pair[j],0,StartBarTime));
PairEndTime[j] = iTime(Pair[j],0,0);
}
EndTime = TimeCurrent();
for(int i=StartBar; i>=0; i--) {
DefineSpread();
for(j=0;j<6;j++) {
PairStartAsk[j] = iOpen(Pair[j],0,StartBar)+(PairSpread[j]*PairPip[j]);
PairStartBid[j] = iOpen(Pair[j],0,StartBar);
PairEndAsk[j] = iClose(Pair[j],0,i)+(PairSpread[j]*PairPip[j]);
PairEndBid[j] = iClose(Pair[j],0,i);
}
//For Buy pairs, subtract starting price (artificial Ask from start of week) from ending price (Bid now), then divide by 100 (if JPY pair), then multiply by 10000, to get pips gained or lost as whole numbers.
//For Sell pairs, subtract ending price (Ask now) from starting price (Bid from start of week), then divide by 100 (if JPY pair), then multiply by 10000, to get pips gained or lost as whole numbers.
for(j=0;j<3;j++) {
if( StringFind(Pair[j],"JPY",0)!=-1) {
Buys[j] = ((PairEndBid[j]-PairStartAsk[j])/100)*10000;
BuysIfSold[j] = ((PairStartBid[j]-PairEndAsk[j])/100)*10000;
} else {
Buys[j] = (PairEndBid[j]-PairStartAsk[j])*10000;
BuysIfSold[j] = (PairStartBid[j]-PairEndAsk[j])*10000;
}
}
for(j=3;j<6;j++) {
if( StringFind(Pair[j],"JPY",0)!=-1) {
Sells[j] = ((PairStartBid[j]-PairEndAsk[j])/100)*10000;
SellsIfBought[j] = ((PairEndBid[j]-PairStartAsk[j])/100)*10000;
} else {
Sells[j] = (PairStartBid[j]-PairEndAsk[j])*10000;
SellsIfBought[j] = (PairEndBid[j]-PairStartAsk[j])*10000;
}
}
if(MarketInfo(Symbol(),MODE_LOTSIZE) == 100000) LotsForIndis = 0.1;
else if(MarketInfo(Symbol(),MODE_LOTSIZE) == 10000) LotsForIndis = 1.0;
else if(MarketInfo(Symbol(),MODE_LOTSIZE) == 1000) LotsForIndis = 10.0;
if(UsePipCurrencyValue == True) {
DefinePipValuePerLotForEachPair();
for (j=0;j<6;j++) {
PairSpreadCost[j] = PairSpread[j]*PairPipValuePerLot[j]*LotsForIndis;
}
for(j=0;j<3;j++) {
Buys[j] = Buys[j]*PairPipValuePerLot[j]*LotsForIndis;
BuysIfSold[j] = BuysIfSold[j]*PairPipValuePerLot[j]*LotsForIndis;
}
for(j=3;j<6;j++) {
Sells[j] = Sells[j]*PairPipValuePerLot[j]*LotsForIndis;
SellsIfBought[j] = SellsIfBought[j]*PairPipValuePerLot[j]*LotsForIndis;
}
}
double sum_Buys=0;
double sum_BuysIfSold=0;
double sum_Sells=0;
double sum_SellsIfBought=0;
for(j=0;j<3;j++) {
sum_Buys = sum_Buys+Buys[j];
sum_BuysIfSold = sum_BuysIfSold+BuysIfSold[j];
}
for(j=3;j<6;j++) {
sum_Sells = sum_Sells+Sells[j];
sum_SellsIfBought = sum_SellsIfBought+SellsIfBought[j];
}
double sum_BuysSpread=0;
double sum_SellsSpread=0;
double sum_Spread=0;
for(j=0;j<3;j++) {
sum_BuysSpread = sum_BuysSpread+PairSpread[j];
}
for(j=3;j<6;j++) {
sum_SellsSpread = sum_SellsSpread+PairSpread[j];
}
for(j=0;j<6;j++) {
sum_Spread = sum_Spread+PairSpread[j];
}
if(ShowBuysLine == True) ExtMapBuffer1[i] = sum_Buys;
if(ShowSellsLine == True) ExtMapBuffer2[i] = sum_Sells;
if(ShowTotalLine == True) ExtMapBuffer3[i] = sum_Buys+sum_Sells;
if(ShowBuyAllLine == True) ExtMapBuffer4[i] = sum_Buys+sum_SellsIfBought;
if(ShowSellAllLine == True) ExtMapBuffer5[i] = sum_BuysIfSold+sum_Sells;
BuysSpreadCostTotal = PairSpreadCost[0]+PairSpreadCost[1]+PairSpreadCost[2]+PairSpreadCost[3];
SellsSpreadCostTotal = PairSpreadCost[4]+PairSpreadCost[5];
SpreadCostTotal = BuysSpreadCostTotal+SellsSpreadCostTotal;
//Make an array, that will keep all the most recent values (pips gained or lost) from the above calculations for each pair
ArrayInitialize(SortingArray,0.0);
//fill the first 3 places, 0-2, with Buy pairs' gains
for (j=0;j<3;j++) {
SortingArray[j] = Buys[j];
}
//fill the second 3 places, 3-5, with Sell pairs' gains
for (j=3;j<6;j++) {
SortingArray[j] = Sells[j];
}
//Sort the values in the array from most gain to most loss
ArraySort(SortingArray,WHOLE_ARRAY,0,MODE_DESCEND);
ReassociatePairsWithArray();
//Give color to those values (objects created below) depending on if a Buy Pair (BuyPairs_color) or Sell pair (SellPairs_color)
for(j=0;j<6;j++) {
if(Position[j] == Pair[0] || Position[j] == Pair[1] || Position[j] == Pair[2] || Position[j] == Pair[3]) {
PairColor[j] = BuyPairs_Color;
} else {
PairColor[j] = SellPairs_Color;
}
}
//Make strings of the above information to fill the Objects created below
if(UsePipCurrencyValue == False) {
int cvround = 0;
} else {
cvround = 2;
}
for (j=0;j<6;j++) {
PairValue[j] = DoubleToStr(SortingArray[j],cvround);
}
TotalProfitBuys = DoubleToStr(sum_Buys,2);
TotalProfitSells = DoubleToStr(sum_Sells,2);
TotalP_L = DoubleToStr(sum_Buys+sum_Sells,2);
IfBuyAll_Value = DoubleToStr(sum_Buys+sum_SellsIfBought,2);
IfSellAll_Value = DoubleToStr(sum_BuysIfSold+sum_Sells,2);
}
if(ShowTotalLine == True) {
if(StartBar > 20) StartBar -= 20;
//Do the Moving Average
for(i = StartBar; i >= 0; i--) {
ExtMapBuffer6[i] = iMAOnArray(ExtMapBuffer3,0,20,0,MODE_LWMA,i);
}
}
if(StrToDouble(TotalProfitBuys) > 0) TotalProfitBuysColor = Positive_Color;
else if(StrToDouble(TotalProfitBuys) < 0) TotalProfitBuysColor = Negative_Color;
else if(StrToDouble(TotalProfitBuys) == 0) TotalProfitBuysColor = White;
if(StrToDouble(TotalProfitSells) > 0) TotalProfitSellsColor = Positive_Color;
else if(StrToDouble(TotalProfitSells) < 0) TotalProfitSellsColor = Negative_Color;
else if(StrToDouble(TotalProfitSells) == 0) TotalProfitSellsColor = White;
if(StrToDouble(IfBuyAll_Value) > 0) TotalProfitBuyAllColor = Positive_Color;
else if(StrToDouble(IfBuyAll_Value) < 0) TotalProfitBuyAllColor = Negative_Color;
else if(StrToDouble(IfBuyAll_Value) == 0) TotalProfitBuyAllColor = White;
if(StrToDouble(IfSellAll_Value) > 0) TotalProfitSellAllColor = Positive_Color;
else if(StrToDouble(IfSellAll_Value) < 0) TotalProfitSellAllColor = Negative_Color;
else if(StrToDouble(IfSellAll_Value) == 0) TotalProfitSellAllColor = White;
if(ShowComments == True) {
ShowCommentsThen();
}
if(DrawObjects == True) {
DrawObjectsThen();
}
if(LastBid != ExtMapBuffer4[0]) LastBid = ExtMapBuffer4[0];
//----
return(0);
}
//+------------------------------------------------------------------+
void ChooseT101PairSet() {
Pair_Suffix=StringSubstr(Symbol(),6,StringLen(Symbol())-6);
Pair[0] = "EURJPY"+Pair_Suffix;
Pair[1] = "USDCHF"+Pair_Suffix;
Pair[2] = "GBPUSD"+Pair_Suffix;
Pair[3] = "EURUSD"+Pair_Suffix;
Pair[4] = "USDJPY"+Pair_Suffix;
Pair[5] = "GBPCHF"+Pair_Suffix;
return;
}
void DefinePipForEachPair() {
for(int j=0;j<6;j++) {
if(Point == 0.0001 || Point == 0.01) {
PairPip[j] = MarketInfo(Pair[j],MODE_POINT);
} else if(Point == 0.00001 || Point == 0.001) {
PairPip[j] = MarketInfo(Pair[j],MODE_POINT)*10;
}
}
return;
}
void DefineSpread() {
if(UseSpread == True) {
for(int j=0;j<6;j++) {
if(Point == 0.00001 || Point == 0.001) {
PairSpread[j] = NormalizeDouble(MarketInfo(Pair[j],MODE_SPREAD)/10,1);
} else if(Point == 0.0001 || Point == 0.01) {
PairSpread[j] = NormalizeDouble(MarketInfo(Pair[j],MODE_SPREAD),0);
}
}
} else {
for(j=0;j<6;j++) {
PairSpread[j] = 0;
}
}
return;
}
void DefinePipValuePerLotForEachPair() {
for(int j=0;j<6;j++) {
if(Point == 0.0001 || Point == 0.01) {
PairPipValuePerLot[j] = MarketInfo(Pair[j], MODE_TICKVALUE);
} else if(Point == 0.00001 || Point == 0.001) {
PairPipValuePerLot[j] = MarketInfo(Pair[j], MODE_TICKVALUE)*10;
}
}
return;
}
void ShowCommentsThen() {
if((PairEndTime[0]+(Period()*60)-60) > TimeCurrent()) PairEndTime[0] = TimeCurrent();
else PairEndTime[0] = (PairEndTime[0]+(Period()*60)-60);
for(int j=0;j<6;j++) {
digits[j] = MarketInfo(Pair[j],MODE_DIGITS);
}
Comment(
"---------------------------------------" + "n" +
"For real GMT Time, check: http://wwp.greenwichmeantime.com/" + "n" +
"User inputs are correct if real GMT Time is: " + TimeToStr(GMT_Time) + "n" +
"Broker GMT Offset = " + Broker_GMTOffset + " (user input)" + "n" +
"On Daylight Savings Time = " + OnDaylightSavingsTime + " (user input)" + "n" +
"---------------------------------------" + "n" +
"Broker Server Time Now = " + TimeToStr(TimeCurrent()) + "n" +
"---------------------------------------" + "n" +
"Forex Week Open Time In GMT Time = " + TimeToStr(GMT_Forex_WeekOpenTime) + "n" +
"Forex Week Open Time On This Broker = " + TimeToStr(Forex_WeekOpenTime_ThisBroker) + "n" +
"StartBar = " + StartBar + "n" +
"---------------------------------------" + "n" +
Pair[0]+": " + "Open Bar Open Time = " + TimeToStr(PairStartTime[0]) + ", Open Price (faux Ask) = " + DoubleToStr(PairStartAsk[0],digits[0]) + ", Close Bar Close Time = " + TimeToStr(PairEndTime[0]) + ", Close Price (Bid) = " + DoubleToStr(PairEndBid[0],digits[0]) + ", Pair Gain/Loss = " + DoubleToStr(Buys[0],2) + ", Spread = " + DoubleToStr(PairSpread[0],0) + "n" +
Pair[1]+": " + "Open Bar Open Time = " + TimeToStr(PairStartTime[1]) + ", Open Price (faux Ask) = " + DoubleToStr(PairStartAsk[1],digits[1]) + ", Close Bar Close Time = " + TimeToStr(PairEndTime[0]) + ", Close Price (Bid) = " + DoubleToStr(PairEndBid[1],digits[1]) + ", Pair Gain/Loss = " + DoubleToStr(Buys[1],2) + ", Spread = " + DoubleToStr(PairSpread[1],0) + "n" +
Pair[2]+": " + "Open Bar Open Time = " + TimeToStr(PairStartTime[2]) + ", Open Price (faux Ask) = " + DoubleToStr(PairStartAsk[2],digits[2]) + ", Close Bar Close Time = " + TimeToStr(PairEndTime[0]) + ", Close Price (Bid) = " + DoubleToStr(PairEndBid[2],digits[2]) + ", Pair Gain/Loss = " + DoubleToStr(Buys[2],2) + ", Spread = " + DoubleToStr(PairSpread[2],0) + "n" +
"------------------------------------" + "n" +
Pair[4]+": " + "Open Bar Open Time = " + TimeToStr(PairStartTime[4]) + ", Open Price (Bid) = " + DoubleToStr(PairStartBid[4],digits[4]) + ", Close Bar Close Time = " + TimeToStr(PairEndTime[0]) + ", Close Price (Ask) = " + DoubleToStr(PairEndAsk[4],digits[4]) + ", Pair Gain/Loss = " + DoubleToStr(Sells[4],2) + ", Spread = " + DoubleToStr(PairSpread[4],0) + "n" +
Pair[5]+": " + "Open Bar Open Time = " + TimeToStr(PairStartTime[5]) + ", Open Price (Bid) = " + DoubleToStr(PairStartBid[5],digits[5]) + ", Close Bar Close Time = " + TimeToStr(PairEndTime[0]) + ", Close Price (Ask) = " + DoubleToStr(PairEndAsk[5],digits[5]) + ", Pair Gain/Loss = " + DoubleToStr(Sells[5],2) + ", Spread = " + DoubleToStr(PairSpread[5],0) + "n" +
Pair[6]+": " + "Open Bar Open Time = " + TimeToStr(PairStartTime[6]) + ", Open Price (Bid) = " + DoubleToStr(PairStartBid[6],digits[6]) + ", Close Bar Close Time = " + TimeToStr(PairEndTime[0]) + ", Close Price (Ask) = " + DoubleToStr(PairEndAsk[6],digits[6]) + ", Pair Gain/Loss = " + DoubleToStr(Sells[6],2) + ", Spread = " + DoubleToStr(PairSpread[6],0) + "n" +
"------------------------------------" + "n" +
"Buys Profit = " + DoubleToStr(ExtMapBuffer1[0],2) + "n" +
"Sells Profit = " + DoubleToStr(ExtMapBuffer2[0],2) + "n" +
"Buys and Sells Total Profit = " + DoubleToStr(ExtMapBuffer3[0],2) + "n" +
"LastBid = " + DoubleToStr(LastBid,2) + "n" +
"Total Profit If Buying All = " + DoubleToStr(ExtMapBuffer4[0],2) + "n" +
"Total Profit If Selling All = " + DoubleToStr(ExtMapBuffer5[0],2)
);
return;
}
void ReassociatePairsWithArray() { //Re-associate the values in the array with the pairs the values belong to
if(SortingArray[0] == Buys[0]) {
Position[0] = Pair[0];
} else if(SortingArray[0] == Buys[1]) {
Position[0] = Pair[1];
} else if(SortingArray[0] == Buys[2]) {
Position[0] = Pair[2];
} else if(SortingArray[0] == Buys[3]) {
Position[0] = Pair[3];
} else if(SortingArray[0] == Sells[4]) {
Position[0] = Pair[4];
} else if(SortingArray[0] == Sells[5]) {
Position[0] = Pair[5];
}
if(SortingArray[1] == Buys[0]) {
Position[1] = Pair[0];
} else if(SortingArray[1] == Buys[1]) {
Position[1] = Pair[1];
} else if(SortingArray[1] == Buys[2]) {
Position[1] = Pair[2];
} else if(SortingArray[1] == Buys[3]) {
Position[1] = Pair[3];
} else if(SortingArray[1] == Sells[4]) {
Position[1] = Pair[4];
} else if(SortingArray[1] == Sells[5]) {
Position[1] = Pair[5];
}
if(SortingArray[2] == Buys[0]) {
Position[2] = Pair[0];
} else if(SortingArray[2] == Buys[1]) {
Position[2] = Pair[1];
} else if(SortingArray[2] == Buys[2]) {
Position[2] = Pair[2];
} else if(SortingArray[2] == Buys[3]) {
Position[2] = Pair[3];
} else if(SortingArray[2] == Sells[4]) {
Position[2] = Pair[4];
} else if(SortingArray[2] == Sells[5]) {
Position[2] = Pair[5];
}
if(SortingArray[3] == Buys[0]) {
Position[3] = Pair[0];
} else if(SortingArray[3] == Buys[1]) {
Position[3] = Pair[1];
} else if(SortingArray[3] == Buys[2]) {
Position[3] = Pair[2];
} else if(SortingArray[3] == Buys[3]) {
Position[3] = Pair[3];
} else if(SortingArray[3] == Sells[4]) {
Position[3] = Pair[4];
} else if(SortingArray[3] == Sells[5]) {
Position[3] = Pair[5];
}
if(SortingArray[4] == Buys[0]) {
Position[4] = Pair[0];
} else if(SortingArray[4] == Buys[1]) {
Position[4] = Pair[1];
} else if(SortingArray[4] == Buys[2]) {
Position[4] = Pair[2];
} else if(SortingArray[4] == Buys[3]) {
Position[4] = Pair[3];
} else if(SortingArray[4] == Sells[4]) {
Position[4] = Pair[4];
} else if(SortingArray[4] == Sells[5]) {
Position[4] = Pair[5];
}
if(SortingArray[5] == Buys[0]) {
Position[5] = Pair[0];
} else if(SortingArray[5] == Buys[1]) {
Position[5] = Pair[1];
} else if(SortingArray[5] == Buys[2]) {
Position[5] = Pair[2];
} else if(SortingArray[5] == Buys[3]) {
Position[5] = Pair[3];
} else if(SortingArray[5] == Sells[4]) {
Position[5] = Pair[4];
} else if(SortingArray[5] == Sells[5]) {
Position[5] = Pair[5];
}
if(SortingArray[6] == Buys[0]) {
Position[6] = Pair[0];
} else if(SortingArray[6] == Buys[1]) {
Position[6] = Pair[1];
} else if(SortingArray[6] == Buys[2]) {
Position[6] = Pair[2];
} else if(SortingArray[6] == Buys[3]) {
Position[6] = Pair[3];
} else if(SortingArray[6] == Sells[4]) {
Position[6] = Pair[4];
} else if(SortingArray[6] == Sells[5]) {
Position[6] = Pair[5];
}
if(SortingArray[7] == Buys[0]) {
Position[7] = Pair[0];
} else if(SortingArray[7] == Buys[1]) {
Position[7] = Pair[1];
} else if(SortingArray[7] == Buys[2]) {
Position[7] = Pair[2];
} else if(SortingArray[7] == Buys[3]) {
Position[7] = Pair[3];
} else if(SortingArray[7] == Sells[4]) {
Position[7] = Pair[4];
} else if(SortingArray[7] == Sells[5]) {
Position[7] = Pair[5];
}
return;
}
void DrawObjectsThen() {
//ObjectsDeleteAll();
ObjectCreate(shortname + "50", OBJ_LABEL, 0, 0, 0);
ObjectSetText(shortname + "50"," StartTime:"+TimeToStr(PairStartTime[0]),7, "Arial Bold", White);
ObjectSet(shortname + "50", OBJPROP_CORNER, 0);
ObjectSet(shortname + "50", OBJPROP_XDISTANCE, 10+myXoffset);
ObjectSet(shortname + "50", OBJPROP_YDISTANCE, 0+myYoffset);
ObjectCreate(shortname + "51", OBJ_LABEL, 0, 0, 0);
ObjectSetText(shortname + "51"," EndTime:"+TimeToStr(PairEndTime[0]),7, "Arial Bold", White);
ObjectSet(shortname + "51", OBJPROP_CORNER, 0);
ObjectSet(shortname + "51", OBJPROP_XDISTANCE, 10+myXoffset);
ObjectSet(shortname + "51", OBJPROP_YDISTANCE, 12+myYoffset);
ObjectCreate(shortname + "3", OBJ_LABEL, 0, 0, 0);
ObjectSetText(shortname + "3",StringSubstr(Position[0],0),12, "Arial Bold", PairColor[0]);
ObjectSet(shortname + "3", OBJPROP_CORNER, 0);
ObjectSet(shortname + "3", OBJPROP_XDISTANCE, 10+myXoffset);
ObjectSet(shortname + "3", OBJPROP_YDISTANCE, 25+myYoffset);
if(ShowIndividualGainsLosses == True) {
ObjectCreate(shortname + "4", OBJ_LABEL, 0, 0, 0);
ObjectSetText(shortname + "4",StringSubstr(PairValue[0],0),12, "Arial Bold", PairColor[0]);
ObjectSet(shortname + "4", OBJPROP_CORNER, 0);
ObjectSet(shortname + "4", OBJPROP_XDISTANCE, 105+myXoffset);
ObjectSet(shortname + "4", OBJPROP_YDISTANCE, 25+myYoffset);
}
ObjectCreate(shortname + "5", OBJ_LABEL, 0, 0, 0);
ObjectSetText(shortname + "5",StringSubstr(Position[1],0),12, "Arial Bold", PairColor[1]);
ObjectSet(shortname + "5", OBJPROP_CORNER, 0);
ObjectSet(shortname + "5", OBJPROP_XDISTANCE, 10+myXoffset);
ObjectSet(shortname + "5", OBJPROP_YDISTANCE, 40+myYoffset);
if(ShowIndividualGainsLosses == True) {
ObjectCreate(shortname + "6", OBJ_LABEL, 0, 0, 0);
ObjectSetText(shortname + "6",StringSubstr(PairValue[1],0),12, "Arial Bold", PairColor[1]);
ObjectSet(shortname + "6", OBJPROP_CORNER, 0);
ObjectSet(shortname + "6", OBJPROP_XDISTANCE, 105+myXoffset);
ObjectSet(shortname + "6", OBJPROP_YDISTANCE, 40+myYoffset);
}
ObjectCreate(shortname + "7", OBJ_LABEL, 0, 0, 0);
ObjectSetText(shortname + "7",StringSubstr(Position[2],0),12, "Arial Bold", PairColor[2]);
ObjectSet(shortname + "7", OBJPROP_CORNER, 0);
ObjectSet(shortname + "7", OBJPROP_XDISTANCE, 10+myXoffset);
ObjectSet(shortname + "7", OBJPROP_YDISTANCE, 55+myYoffset);
if(ShowIndividualGainsLosses == True) {
ObjectCreate(shortname + "8", OBJ_LABEL, 0, 0, 0);
ObjectSetText(shortname + "8",StringSubstr(PairValue[2],0),12, "Arial Bold", PairColor[2]);
ObjectSet(shortname + "8", OBJPROP_CORNER, 0);
ObjectSet(shortname + "8", OBJPROP_XDISTANCE, 105+myXoffset);
ObjectSet(shortname + "8", OBJPROP_YDISTANCE, 55+myYoffset);
}
ObjectCreate(shortname + "9", OBJ_LABEL, 0, 0, 0);
ObjectSetText(shortname + "9",StringSubstr(Position[3],0),12, "Arial Bold", PairColor[3]);
ObjectSet(shortname + "9", OBJPROP_CORNER, 0);
ObjectSet(shortname + "9", OBJPROP_XDISTANCE, 10+myXoffset);
ObjectSet(shortname + "9", OBJPROP_YDISTANCE, 70+myYoffset);
if(ShowIndividualGainsLosses == True) {
ObjectCreate(shortname + "10", OBJ_LABEL, 0, 0, 0);
ObjectSetText(shortname + "10",StringSubstr(PairValue[3],0),12, "Arial Bold", PairColor[3]);
ObjectSet(shortname + "10", OBJPROP_CORNER, 0);
ObjectSet(shortname + "10", OBJPROP_XDISTANCE, 105+myXoffset);
ObjectSet(shortname + "10", OBJPROP_YDISTANCE, 70+myYoffset);
}
if(ShowIndividualGainsLosses == False) {
ObjectCreate(shortname + "49", OBJ_LABEL, 0, 0, 0);
ObjectSetText(shortname + "49","--------------",12, "Arial Bold", White);
ObjectSet(shortname + "49", OBJPROP_CORNER, 0);
ObjectSet(shortname + "49", OBJPROP_XDISTANCE, 10+myXoffset);
ObjectSet(shortname + "49", OBJPROP_YDISTANCE, 75+myYoffset);
} else if(ShowIndividualGainsLosses == True) {
ObjectCreate(shortname + "49", OBJ_LABEL, 0, 0, 0);
ObjectSetText(shortname + "49","------------------------------",12, "Arial Bold", White);
ObjectSet(shortname + "49", OBJPROP_CORNER, 0);
ObjectSet(shortname + "49", OBJPROP_XDISTANCE, 10+myXoffset);
ObjectSet(shortname + "49", OBJPROP_YDISTANCE, 75+myYoffset);
}
ObjectCreate(shortname + "11", OBJ_LABEL, 0, 0, 0);
ObjectSetText(shortname + "11",StringSubstr(Position[4],0),12, "Arial Bold", PairColor[4]);
ObjectSet(shortname + "11", OBJPROP_CORNER, 0);
ObjectSet(shortname + "11", OBJPROP_XDISTANCE, 10+myXoffset);
ObjectSet(shortname + "11", OBJPROP_YDISTANCE, 85+myYoffset);
if(ShowIndividualGainsLosses == True) {
ObjectCreate(shortname + "12", OBJ_LABEL, 0, 0, 0);
ObjectSetText(shortname + "12",StringSubstr(PairValue[4],0),12, "Arial Bold", PairColor[4]);
ObjectSet(shortname + "12", OBJPROP_CORNER, 0);
ObjectSet(shortname + "12", OBJPROP_XDISTANCE, 105+myXoffset);
ObjectSet(shortname + "12", OBJPROP_YDISTANCE, 85+myYoffset);
}
ObjectCreate(shortname + "13", OBJ_LABEL, 0, 0, 0);
ObjectSetText(shortname + "13",StringSubstr(Position[5],0),12, "Arial Bold", PairColor[5]);
ObjectSet(shortname + "13", OBJPROP_CORNER, 0);
ObjectSet(shortname + "13", OBJPROP_XDISTANCE, 10+myXoffset);
ObjectSet(shortname + "13", OBJPROP_YDISTANCE, 100+myYoffset);
if(ShowIndividualGainsLosses == True) {
ObjectCreate(shortname + "14", OBJ_LABEL, 0, 0, 0);
ObjectSetText(shortname + "14",StringSubstr(PairValue[5],0),12, "Arial Bold", PairColor[5]);
ObjectSet(shortname + "14", OBJPROP_CORNER, 0);
ObjectSet(shortname + "14", OBJPROP_XDISTANCE, 105+myXoffset);
ObjectSet(shortname + "14", OBJPROP_YDISTANCE, 100+myYoffset);
}
ObjectCreate(shortname + "15", OBJ_LABEL, 0, 0, 0);
ObjectSetText(shortname + "15",StringSubstr(Position[6],0),12, "Arial Bold", PairColor[6]);
ObjectSet(shortname + "15", OBJPROP_CORNER, 0);
ObjectSet(shortname + "15", OBJPROP_XDISTANCE, 10+myXoffset);
ObjectSet(shortname + "15", OBJPROP_YDISTANCE, 115+myYoffset);
if(ShowIndividualGainsLosses == True) {
ObjectCreate(shortname + "16", OBJ_LABEL, 0, 0, 0);
ObjectSetText(shortname + "16",StringSubstr(PairValue[6],0),12, "Arial Bold", PairColor[6]);
ObjectSet(shortname + "16", OBJPROP_CORNER, 0);
ObjectSet(shortname + "16", OBJPROP_XDISTANCE, 105+myXoffset);
ObjectSet(shortname + "16", OBJPROP_YDISTANCE, 115+myYoffset);
}
ObjectCreate(shortname + "17", OBJ_LABEL, 0, 0, 0);
ObjectSetText(shortname + "17",StringSubstr(Position[7],0),12, "Arial Bold", PairColor[7]);
ObjectSet(shortname + "17", OBJPROP_CORNER, 0);
ObjectSet(shortname + "17", OBJPROP_XDISTANCE, 10+myXoffset);
ObjectSet(shortname + "17", OBJPROP_YDISTANCE, 130+myYoffset);
if(ShowIndividualGainsLosses == True) {
ObjectCreate(shortname + "18", OBJ_LABEL, 0, 0, 0);
ObjectSetText(shortname + "18",StringSubstr(PairValue[7],0),12, "Arial Bold", PairColor[7]);
ObjectSet(shortname + "18", OBJPROP_CORNER, 0);
ObjectSet(shortname + "18", OBJPROP_XDISTANCE, 105+myXoffset);
ObjectSet(shortname + "18", OBJPROP_YDISTANCE, 130+myYoffset);
}
ObjectCreate(shortname + "31", OBJ_LABEL, 0, 0, 0);
ObjectSetText(shortname + "31",StringSubstr("Buys Profit",0),12, "Arial Bold", White);
ObjectSet(shortname + "31", OBJPROP_CORNER, 0);
ObjectSet(shortname + "31", OBJPROP_XDISTANCE, 10+myXoffset);
ObjectSet(shortname + "31", OBJPROP_YDISTANCE, 150+myYoffset);
ObjectCreate(shortname + "32", OBJ_LABEL, 0, 0, 0);
ObjectSetText(shortname + "32",StringSubstr(TotalProfitBuys,0),12, "Arial Bold", TotalProfitBuysColor);
ObjectSet(shortname + "32", OBJPROP_CORNER, 0);
ObjectSet(shortname + "32", OBJPROP_XDISTANCE, 105+myXoffset);
ObjectSet(shortname + "32", OBJPROP_YDISTANCE, 150+myYoffset);
ObjectCreate(shortname + "33", OBJ_LABEL, 0, 0, 0);
ObjectSetText(shortname + "33",StringSubstr("Sells Profit",0),12, "Arial Bold", White);
ObjectSet(shortname + "33", OBJPROP_CORNER, 0);
ObjectSet(shortname + "33", OBJPROP_XDISTANCE, 10+myXoffset);
ObjectSet(shortname + "33", OBJPROP_YDISTANCE, 165+myYoffset);
ObjectCreate(shortname + "34", OBJ_LABEL, 0, 0, 0);
ObjectSetText(shortname + "34",StringSubstr(TotalProfitSells,0),12, "Arial Bold", TotalProfitSellsColor);
ObjectSet(shortname + "34", OBJPROP_CORNER, 0);
ObjectSet(shortname + "34", OBJPROP_XDISTANCE, 105+myXoffset);
ObjectSet(shortname + "34", OBJPROP_YDISTANCE, 165+myYoffset);
ObjectCreate(shortname + "35", OBJ_LABEL, 0, 0, 0);
ObjectSetText(shortname + "35",StringSubstr("Total P/L",0),12, "Arial Bold", White);
ObjectSet(shortname + "35", OBJPROP_CORNER, 0);
ObjectSet(shortname + "35", OBJPROP_XDISTANCE, 10+myXoffset);
ObjectSet(shortname + "35", OBJPROP_YDISTANCE, 180+myYoffset);
ObjectCreate(shortname + "36", OBJ_LABEL, 0, 0, 0);
ObjectSetText(shortname + "36",StringSubstr(TotalP_L,0),12, "Arial Bold", White);
ObjectSet(shortname + "36", OBJPROP_CORNER, 0);
ObjectSet(shortname + "36", OBJPROP_XDISTANCE, 105+myXoffset);
ObjectSet(shortname + "36", OBJPROP_YDISTANCE, 180+myYoffset);
ObjectCreate(shortname + "39", OBJ_LABEL, 0, 0, 0);
ObjectSetText(shortname + "39",StringSubstr("Buys Spread",0),12, "Arial Bold", White);
ObjectSet(shortname + "39", OBJPROP_CORNER, 0);
ObjectSet(shortname + "39", OBJPROP_XDISTANCE, 10+myXoffset);
ObjectSet(shortname + "39", OBJPROP_YDISTANCE, 195+myYoffset);
ObjectCreate(shortname + "40", OBJ_LABEL, 0, 0, 0);
ObjectSetText(shortname + "40",DoubleToStr(BuysSpreadCostTotal,2),12, "Arial Bold", White);
ObjectSet(shortname + "40", OBJPROP_CORNER, 0);
ObjectSet(shortname + "40", OBJPROP_XDISTANCE, 105+myXoffset);
ObjectSet(shortname + "40", OBJPROP_YDISTANCE, 195+myYoffset);
ObjectCreate(shortname + "41", OBJ_LABEL, 0, 0, 0);
ObjectSetText(shortname + "41",StringSubstr("Sells Spread",0),12, "Arial Bold", White);
ObjectSet(shortname + "41", OBJPROP_CORNER, 0);
ObjectSet(shortname + "41", OBJPROP_XDISTANCE, 10+myXoffset);
ObjectSet(shortname + "41", OBJPROP_YDISTANCE, 210+myYoffset);
ObjectCreate(shortname + "42", OBJ_LABEL, 0, 0, 0);
ObjectSetText(shortname + "42",DoubleToStr(SellsSpreadCostTotal,2),12, "Arial Bold", White);
ObjectSet(shortname + "42", OBJPROP_CORNER, 0);
ObjectSet(shortname + "42", OBJPROP_XDISTANCE, 105+myXoffset);
ObjectSet(shortname + "42", OBJPROP_YDISTANCE, 210+myYoffset);
ObjectCreate(shortname + "43", OBJ_LABEL, 0, 0, 0);
ObjectSetText(shortname + "43",StringSubstr("Total Spread",0),12, "Arial Bold", White);
ObjectSet(shortname + "43", OBJPROP_CORNER, 0);
ObjectSet(shortname + "43", OBJPROP_XDISTANCE, 10+myXoffset);
ObjectSet(shortname + "43", OBJPROP_YDISTANCE, 225+myYoffset);
ObjectCreate(shortname + "44", OBJ_LABEL, 0, 0, 0);
ObjectSetText(shortname + "44",DoubleToStr(SpreadCostTotal,2),12, "Arial Bold", White);
ObjectSet(shortname + "44", OBJPROP_CORNER, 0);
ObjectSet(shortname + "44", OBJPROP_XDISTANCE, 105+myXoffset);
ObjectSet(shortname + "44", OBJPROP_YDISTANCE, 225+myYoffset);
ObjectCreate(shortname + "45", OBJ_LABEL, 0, 0, 0);
ObjectSetText(shortname + "45",StringSubstr("Buy All P/L",0),12, "Arial Bold", White);
ObjectSet(shortname + "45", OBJPROP_CORNER, 0);
ObjectSet(shortname + "45", OBJPROP_XDISTANCE, 10+myXoffset);
ObjectSet(shortname + "45", OBJPROP_YDISTANCE, 240+myYoffset);
ObjectCreate(shortname + "46", OBJ_LABEL, 0, 0, 0);
ObjectSetText(shortname + "46",IfBuyAll_Value,12, "Arial Bold", TotalProfitBuyAllColor);
ObjectSet(shortname + "46", OBJPROP_CORNER, 0);
ObjectSet(shortname + "46", OBJPROP_XDISTANCE, 105+myXoffset);
ObjectSet(shortname + "46", OBJPROP_YDISTANCE, 240+myYoffset);
ObjectCreate(shortname + "47", OBJ_LABEL, 0, 0, 0);
ObjectSetText(shortname + "47",StringSubstr("Sell All P/L ",0),12, "Arial Bold", White);
ObjectSet(shortname + "47", OBJPROP_CORNER, 0);
ObjectSet(shortname + "47", OBJPROP_XDISTANCE, 10+myXoffset);
ObjectSet(shortname + "47", OBJPROP_YDISTANCE, 255+myYoffset);
ObjectCreate(shortname + "48", OBJ_LABEL, 0, 0, 0);
ObjectSetText(shortname + "48",IfSellAll_Value,12, "Arial Bold", TotalProfitSellAllColor);
ObjectSet(shortname + "48", OBJPROP_CORNER, 0);
ObjectSet(shortname + "48", OBJPROP_XDISTANCE, 105+myXoffset);
ObjectSet(shortname + "48", OBJPROP_YDISTANCE, 255+myYoffset);
return;
}
#include <zznbrm.datetime.mqh> //zznbrm
Hi ES Trader,
I have no idea what I was doing. I was probably changing it by instinct, anyway see if the calculations shown on screen is what you want.
attached the includes file used for this indicator:
zznbrm.datetime.mqh -> put in "includes" folder
I have no idea what I was doing. I was probably changing it by instinct, anyway see if the calculations shown on screen is what you want.
attached the includes file used for this indicator:
zznbrm.datetime.mqh -> put in "includes" folder
Attached File(s)
buy sell 3 pairs.mq4
32 KB
|
933 downloads
zznbrm.datetime.mqh
23 KB
|
680 downloads