You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
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);
}