Hello,
I have problem with my EA to reset a flag ( in this sample = false ). I build Auto EA stop loss modify and dont know how to reset flag when is order close or come to stop loss.
This is if PROFIT come to +20 pips than EA auto change stop loss profit/2 and make new limit order AND give SET20 on TRUE!
But now problem if price come to STOP LOSS and close order and come to this order open price i wonna to EA track new order agen that meen its must give SET20==false but i dont know why this not work :
code for set20==false :
I am attach my EA to see full sourse ..
Please help me to fix that ..
Thanks
I have problem with my EA to reset a flag ( in this sample = false ). I build Auto EA stop loss modify and dont know how to reset flag when is order close or come to stop loss.
PHP Code
if (OrderType()==OP_BUY)
{
diff=(Bid-OrderOpenPrice())/Point;
if (diff>=220 && Set20==false)
{
{
sl=OrderOpenPrice()+(diff*Point/2);
tp=Bid+(1000*Point);
if(OrderStopLoss()>0 && sl>OrderStopLoss())
{
OrderModify(OrderTicket(),OrderOpenPrice(),sl,tp,0,CLR_NONE);
openLimit(OP_BUYLIMIT,OrderOpenPrice());
}
if(OrderStopLoss()==0)
{
OrderModify(OrderTicket(),OrderOpenPrice(),sl,tp,0,CLR_NONE);
openLimit(OP_BUYLIMIT,OrderOpenPrice());
}
Set20=true;
if (Set20==true)
{
Alert ("Stop loss 22pipov! Par: ",Symbol()," Stop loss na: ",sl);
break;
}
}
But now problem if price come to STOP LOSS and close order and come to this order open price i wonna to EA track new order agen that meen its must give SET20==false but i dont know why this not work :
code for set20==false :
PHP Code
if(Set20==true)
{
if (Bid<=sl)
{
Set20=false;
if (Set20==false)
{
Alert ("Cena je dosegla SL na paru: ",Symbol(),"Set20 je False");
break;
}
}
}
I am attach my EA to see full sourse ..
Please help me to fix that ..
Thanks
Attached File(s)
Luka-mody.mq4
31 KB
|
324 downloads