Hi guys,
i really need a help from all of you. I already created EA. My EA work well except the below part.
Please note that: i used
1- OrdersTotal()-1 to get the last orderopenprice.
2-OrderMagicNumber()==MagicNumberLong to be sure there is still orderopenprice for the long position before the last orderopenprice.
3-OrderMagicNumber()==MagicNumberShort to be sure there is still orderopenprice for the short position before the last orderopenprice.
what i want :
in the first line start with if:
if the all conditions happened & the last order type for sell do this condition OrderOpenPrice()-0.0009)>=MarketInf("EURUSD",MODE_BID)
and close the short position.
in the second line start with if:
if the all conditions happened & the last order type for buy do this condition OrderOpenPrice()+0.0008)<=MarketInfo("EURUSD",MODE_BID)
and close the long position.
=========
one more quetion:
if we need to do some calculations like:
(iHigh("EURUSD",PERIOD_H1,0)-OrderOpenPrice())>0.0030) and used timeframe one hour, the problem when we move to the next frame may be the condition will not be available. I need to specify iHigh for the bar that i got OrderOpenPrice from it.
some people advice me to use OrderOpenTime() and shiftbar(), but i do not know how can i used them please provide me with example and many thanks.
i really need a help from all of you. I already created EA. My EA work well except the below part.
Please note that: i used
1- OrdersTotal()-1 to get the last orderopenprice.
2-OrderMagicNumber()==MagicNumberLong to be sure there is still orderopenprice for the long position before the last orderopenprice.
3-OrderMagicNumber()==MagicNumberShort to be sure there is still orderopenprice for the short position before the last orderopenprice.
PHP Code
for(int i=0; i<OrdersTotal(); i++) {
OrderSelect(OrdersTotal()-1, SELECT_BY_POS, MODE_TRADES);
if ( (iCustom("EURUSD",PERIOD_H1,"Aroon_Up_Down(6)",6,1,0) < 100.00000)&& (OrderMagicNumber()==MagicNumberLong) )
{ if ( OrderType()==OP_SELL )
{ if ((OrderOpenPrice()-0.0009)>=MarketInfo("EURUSD",MODE_BID))
{ CLOSESHORT("EURUSD") ;}}}
if ( (iCustom("EURUSD",PERIOD_H1,"Aroon_Up_Down(6)",6,0,0) < 100.00000)&& (OrderMagicNumber()==MagicNumberShort) )
{ if ( OrderType()==OP_BUY )
{ if ((OrderOpenPrice()+0.0008)<=MarketInfo("EURUSD",MODE_BID))
{ CLOSELONG("EURUSD") ;}}}
in the first line start with if:
if the all conditions happened & the last order type for sell do this condition OrderOpenPrice()-0.0009)>=MarketInf("EURUSD",MODE_BID)
and close the short position.
in the second line start with if:
if the all conditions happened & the last order type for buy do this condition OrderOpenPrice()+0.0008)<=MarketInfo("EURUSD",MODE_BID)
and close the long position.
=========
one more quetion:
if we need to do some calculations like:
(iHigh("EURUSD",PERIOD_H1,0)-OrderOpenPrice())>0.0030) and used timeframe one hour, the problem when we move to the next frame may be the condition will not be available. I need to specify iHigh for the bar that i got OrderOpenPrice from it.
some people advice me to use OrderOpenTime() and shiftbar(), but i do not know how can i used them please provide me with example and many thanks.