Have this problem in my code:
Anyone can lend a hand?
You can check out these threads:
- 2014.10.03
- www.mql5.com
Have this problem in my code:
Anyone can lend a hand?
What do you mean by first order, the earliest?
I don't see you comparing OrderOpenTime() at all.
if(OrderTicket()==OrderTicket())
When will this ever be false? So what's its purpose.
What do you mean by first order, the earliest?
I don't see you comparing OrderOpenTime() at all.
When will this ever be false? So what's its purpose.
Yes, I mean the first open order.
That OrderTicket()==OrderTicket() works for me to close first open order at reversal signal in another advisors.
But it's suposed to be always taken the first order value in a forward counter loop.
Yes, I mean the first open order.
That OrderTicket()==OrderTicket() works for me to close first open order at reversal signal in another advisors.
It won't work for anything as it will always be true!
https://www.mql5.com/en/forum/314649
Why are you posting the same question when you have already been answered????
- 2019.05.30
- www.mql5.com
What do you mean by first order, the earliest?
I don't see you comparing OrderOpenTime() at all.
When will this ever be false? So what's its purpose.
Ok, if I do this:
if(OrderOpenTime()<OrderOpenTime()){
OpenTime=OrderOpenTime();
FirstOrder=OrderTicket();
FirstProfit=OrderProfit();
}
...or this:
if(OrderTicket()<OrderTicket()){
FirstOrder=OrderTicket();
FirstProfit=OrderProfit();
}
I get as first unexistent order, this is Ticket 0 with Profit 0.
Ok, if I do this:
...or this:
I get as first unexistent order, this is Ticket 0 with Profit 0.
Show the complete loops and where variables are assign their starting values.
if(OrderOpenTime()<OrderOpenTime()) // if(OrderTicket()<OrderTicket())
Now do you think will these conditions will ever be true??
Show the complete loops and where variables are assign their starting values.
Now do you think will these conditions will ever be true??
Keith Watford you're a hustler.
for(int i=0;i<OrdersTotal();i++){ if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)&& OrderSymbol()==Symbol()&&OrderMagicNumber()==MagicNumber){ if(OpenTime==0||OpenTime<OrderOpenTime()){ Ticket=OrderTicket(); Profit=OrderProfit(); } if(OrderType()==OP_BUY){ BuyOrders++; BuyProfit+=OrderProfit(); BuyOpenPrice=OrderOpenPrice(); if(OrderOpenPrice()==BuyOpenPrice){ FirstBuyOrder=OrderTicket(); FirstBuyProfit=OrderProfit(); } } if(OrderType()==OP_SELL){ SellOrders++; SellProfit+=OrderProfit(); SellOpenPrice=OrderOpenPrice(); if(OrderOpenPrice()==SellOpenPrice){ FirstSellOrder=OrderTicket(); FirstSellProfit=OrderProfit(); } } } }
BuyOpenPrice=OrderOpenPrice();
if(OrderOpenPrice()==BuyOpenPrice)
SellOpenPrice=OrderOpenPrice();
if(OrderOpenPrice()==SellOpenPrice){
Can you honestly not see anything wrong here??
FirstBuyOrder=OrderTicket(); FirstBuyProfit=OrderProfit();
These will just be assigned the value of the last buy order checked in the loop. Same goes for sells.
Why am I a hustler?
Can you honestly not see anything wrong here??
These will just be assigned the value of the last buy order checked in the loop. Same goes for sells.
Why am I a hustler?
First question, if OpenPrice gives the pos 0 this is first open price, why does not the same with ticket or/and profit? Why does it continue iteration looking for higher values?
Second question, why if I compare OpenPrice, OpenTime or OrderTicket by < to find the earlier within the iteration it leads me to an unexistent ticket(0)?
Third question if OP is first OP, don't actually know why this if returning the right value whenever it doesn't to Ticket an Profit, but in that
case,
if I'm getiting the right OP value and then if this value is correct
condition may be give its Ticket and Profit.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Have this problem in my code:
Anyone can lend a hand?