Good day! Can someone explain why the prices on H4 and M15 charts do not match? In the screenshot on M15 the price has crossed the red line (to the left of the vertical line). And a minute later there is a screenshot of H4 where the price is still very far to it (to the right of the line). And here in that program only another dtz has a shadow from the candle (the candle is outermost on the right)
Equal: Good day! Can someone explain why the prices on H4 and M15 charts do not match? In the screenshot on M15 price has crossed the red line (to the left of the vertical line). And a minute later there is a screenshot of H4 where the price is still very far to it (to the right of the line). And here is the screenshot of that program, but another dtz has a shadow of the candle (the candle is outermost on the right)
Are you new to the fact that quotes differ in different brokerage companies? They are different even for demo and real in one and the same brokerage company! What a surprise (:
Everything works, but I'm using a grid advisor, which at the moment covers a bunch of orders and as a result the profit is overlapping each other, I would like the profit of this closed bunch to be totaled and only the amount displayed (as implemented inIceFX DrawProfit indicator), rather than separately for each order as I have now. Help me to make it right :)
Vitalie Postolache: Is it new to you that quotes in different brokerage companies are different? Yes, they are different even for demo and real trade in one and the same brokerage company! What a surprise (:
The surprise is different. This is one and the same real account and the price changes (not the same) just by switching to a different timeframe.
In another brokerage company also on a real account when changing the chart everything is OK! The fact that different prices are different is clear, it is not clear that one has as if two prices at once, one on the minutes, one on the hours is different (very different). I understand that it should not be like that but I wonder where the problem may be. By the way the candlestick "corrected" in about an hour after the opening of the next.
Everything works, but I'm using a grid advisor, which at the moment covers a bunch of orders and as a result the profit is overlapping each other, I would like the profit of this closed bunch to be totaled and only the amount displayed (as implemented inIceFX DrawProfit indicator), rather than separately for each order as I have now. Help me to make it right :)
ilnur17021992: Orders are opened by the robot netmaker, for the whole group it calculates and puts one common TP, at which they are then closed.
Screenshot attached:
It goes like this:
//+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ int TotalPos=-1; voidOnTick() { // остальной код
//-- if(OrdersTotal()!=TotalPos) { // не мучаем каждый тик for(int i=OrdersHistoryTotal()-1; i>=0; i--) { if(OrderSelect(i, SELECT_BY_POS, MODE_HISTORY)) { if(OrderSymbol()==Symbol() && OrderType()<=1) { History();
... } }}} TotalPos=OrdersTotal(); // запомним количество
//-- }
//+------------------------------------------------------------------+ //| Create Object istory | //+------------------------------------------------------------------+ void History() { string Ticket=(string)OrderTicket(); color col=Red; if(OrderType()==0)col=Blue; datetime a=OrderOpenTime(); double b=OrderOpenPrice(); datetime c=OrderCloseTime(); double d=OrderClosePrice(); double prSep=OrderProfit()+OrderCommission()+OrderSwap(); double prAll=0; int cn=0; string hTicket; for(int i=OrdersHistoryTotal()-1; i>=0; i--) { if(OrderSelect(i, SELECT_BY_POS, MODE_HISTORY)) { if(OrderSymbol()==Symbol() && OrderType()<=1) { datetime ct=OrderCloseTime(); // 60 секунд разницы между закрытием первой и последней в сетке if(c<=ct+60 && c>=ct-60) { prAll+=OrderProfit()+OrderCommission()+OrderSwap(); hTicket=(string)OrderTicket(); cn++; } }}} ObjectCreate(Ticket+"Open",OBJ_ARROW,0,a,b); ObjectSet(Ticket+"Open",OBJPROP_COLOR,col); ObjectSet(Ticket+"Open",OBJPROP_ARROWCODE,1);
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Can the price tag(OBJ_ARROW_LEFT_PRICE) have its own text instead of the price, if so how?
And here in that program only another dtz has a shadow from the candle (the candle is outermost on the right)
Good day! Can someone explain why the prices on H4 and M15 charts do not match? In the screenshot on M15 price has crossed the red line (to the left of the vertical line). And a minute later there is a screenshot of H4 where the price is still very far to it (to the right of the line).
And here is the screenshot of that program, but another dtz has a shadow of the candle (the candle is outermost on the right)
Trying to write something similar:IceFX DrawProfit
Code:
{
for(int i=0;i<OrdersHistoryTotal();i++)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY) && OrderSymbol()==Symbol() && OrderType()<=1)
History();
}
}
void History()
{
string Ticket=IntegerToString(OrderTicket());
color col=Red;
if(OrderType()==0)col=Blue;
datetime a=OrderOpenTime();
double b=OrderOpenPrice();
datetime c=OrderCloseTime();
double d=OrderClosePrice();
double profit=OrderProfit();
ObjectCreate(Ticket+"Open",OBJ_ARROW,0,a,b);
ObjectSet(Ticket+"Open",OBJPROP_COLOR,col);
ObjectSet(Ticket+"Open",OBJPROP_ARROWCODE,1);
ObjectCreate(Ticket+"Line",OBJ_TREND,0,a,b,c,d);
ObjectSet(Ticket+"Line",OBJPROP_COLOR,col);
ObjectSet(Ticket+"Line",OBJPROP_WIDTH,1);
ObjectSet(Ticket+"Line",OBJPROP_STYLE,STYLE_DOT);
ObjectSet(Ticket+"Line",OBJPROP_RAY,0);
ObjectCreate(Ticket+"Close",OBJ_ARROW,0,c,d);
ObjectSet(Ticket+"Close",OBJPROP_COLOR,Green);
ObjectSet(Ticket+"Close",OBJPROP_ARROWCODE,3);
ObjectCreate(Ticket+"Profit",OBJ_TEXT,0,c,d);
ObjectSet(Ticket+"Profit",OBJPROP_WIDTH,2);
ObjectSetText(Ticket+"Profit",DoubleToString(profit,2),10,"Arial",White);
ObjectSet(Ticket+"Profit",OBJPROP_PRICE1,d+Point*5);
ObjectSet(Ticket+"Profit",OBJPROP_TIME1,c+10000);
}
Everything works, but I'm using a grid advisor, which at the moment covers a bunch of orders and as a result the profit is overlapping each other, I would like the profit of this closed bunch to be totaled and only the amount displayed (as implemented inIceFX DrawProfit indicator), rather than separately for each order as I have now. Help me to make it right :)
Is it new to you that quotes in different brokerage companies are different? Yes, they are different even for demo and real trade in one and the same brokerage company! What a surprise (:
Trying to write something similar:IceFX DrawProfit
Code:
{
for(int i=0;i<OrdersHistoryTotal();i++)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY) && OrderSymbol()==Symbol() && OrderType()<=1)
History();
}
}
void History()
{
string Ticket=IntegerToString(OrderTicket());
color col=Red;
if(OrderType()==0)col=Blue;
datetime a=OrderOpenTime();
double b=OrderOpenPrice();
datetime c=OrderCloseTime();
double d=OrderClosePrice();
double profit=OrderProfit();
ObjectCreate(Ticket+"Open",OBJ_ARROW,0,a,b);
ObjectSet(Ticket+"Open",OBJPROP_COLOR,col);
ObjectSet(Ticket+"Open",OBJPROP_ARROWCODE,1);
ObjectCreate(Ticket+"Line",OBJ_TREND,0,a,b,c,d);
ObjectSet(Ticket+"Line",OBJPROP_COLOR,col);
ObjectSet(Ticket+"Line",OBJPROP_WIDTH,1);
ObjectSet(Ticket+"Line",OBJPROP_STYLE,STYLE_DOT);
ObjectSet(Ticket+"Line",OBJPROP_RAY,0);
ObjectCreate(Ticket+"Close",OBJ_ARROW,0,c,d);
ObjectSet(Ticket+"Close",OBJPROP_COLOR,Green);
ObjectSet(Ticket+"Close",OBJPROP_ARROWCODE,3);
ObjectCreate(Ticket+"Profit",OBJ_TEXT,0,c,d);
ObjectSet(Ticket+"Profit",OBJPROP_WIDTH,2);
ObjectSetText(Ticket+"Profit",DoubleToString(profit,2),10,"Arial",White);
ObjectSet(Ticket+"Profit",OBJPROP_PRICE1,d+Point*5);
ObjectSet(Ticket+"Profit",OBJPROP_TIME1,c+10000);
}
Everything works, but I'm using a grid advisor, which at the moment covers a bunch of orders and as a result the profit is overlapping each other, I would like the profit of this closed bunch to be totaled and only the amount displayed (as implemented inIceFX DrawProfit indicator), rather than separately for each order as I have now. Help me to make it right :)
Profit counts in a separate cycle
Which is it? How do I determine that specific orders are a group and their profit should be summed?
How do you close them, are they closed as a group through a function or some other way?
Orders are opened by the robot netmaker, for the whole group it calculates and puts one common TP, at which they are then closed.
It goes like this:
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
int TotalPos=-1;
void OnTick()
{
// остальной код
//--
if(OrdersTotal()!=TotalPos) { // не мучаем каждый тик
for(int i=OrdersHistoryTotal()-1; i>=0; i--) {
if(OrderSelect(i, SELECT_BY_POS, MODE_HISTORY)) {
if(OrderSymbol()==Symbol() && OrderType()<=1) {
History();
...
//--}
}}} TotalPos=OrdersTotal(); // запомним количество
}
//+------------------------------------------------------------------+
//| Create Object istory |
//+------------------------------------------------------------------+
void History() {
string Ticket=(string)OrderTicket();
color col=Red;
if(OrderType()==0)col=Blue;
datetime a=OrderOpenTime();
double b=OrderOpenPrice();
datetime c=OrderCloseTime();
double d=OrderClosePrice();
double prSep=OrderProfit()+OrderCommission()+OrderSwap();
double prAll=0;
int cn=0;
string hTicket;
for(int i=OrdersHistoryTotal()-1; i>=0; i--) {
if(OrderSelect(i, SELECT_BY_POS, MODE_HISTORY)) {
if(OrderSymbol()==Symbol() && OrderType()<=1) {
datetime ct=OrderCloseTime();
// 60 секунд разницы между закрытием первой и последней в сетке
if(c<=ct+60 && c>=ct-60) {
prAll+=OrderProfit()+OrderCommission()+OrderSwap();
hTicket=(string)OrderTicket();
cn++;
}
}}}
ObjectCreate(Ticket+"Open",OBJ_ARROW,0,a,b);
ObjectSet(Ticket+"Open",OBJPROP_COLOR,col);
ObjectSet(Ticket+"Open",OBJPROP_ARROWCODE,1);
ObjectCreate(Ticket+"Line",OBJ_TREND,0,a,b,c,d);
ObjectSet(Ticket+"Line",OBJPROP_COLOR,col);
ObjectSet(Ticket+"Line",OBJPROP_WIDTH,1);
ObjectSet(Ticket+"Line",OBJPROP_STYLE,STYLE_DOT);
ObjectSet(Ticket+"Line",OBJPROP_RAY,0);
ObjectCreate(Ticket+"Close",OBJ_ARROW,0,c,d);
ObjectSet(Ticket+"Close",OBJPROP_COLOR,Green);
ObjectSet(Ticket+"Close",OBJPROP_ARROWCODE,3);
Ticket=cn>1?hTicket:Ticket;
ObjectCreate(Ticket+"Profit",OBJ_TEXT,0,c,d);
ObjectSet(Ticket+"Profit",OBJPROP_ANCHOR,0);
ObjectSetText(Ticket+"Profit",DoubleToString(prAll,2),10,"Arial",/*White*/clrBlack);
ObjectSet(Ticket+"Profit",OBJPROP_PRICE1,d);
ObjectSet(Ticket+"Profit",OBJPROP_TIME1,c+Period()*60*2);
}