Hello againMQLDiscussions community!
Im back with another question im hoping someone has the answer for.
I am trying to make a “scanForOrderModify” function that will add SL and TP when a BUYSTOP or SELLSTOP order is activated. This being my first time using pending orders instead of just market orders… im finding it a little difficult.
If I run what I have as “OnTick” to ensure I don’t miss any activated trades it works great but I run into serious memory/cpu use issues.
a basic example of what im going for:
if(OrderType()==(OP_BUY||OP_SELL) && OrderTakeProfit()==0 && OrderStopLoss==0) //Catch any that haven't been modified, while not changing any that have already been modified.
{
ScanForModify();
}
However, it seems to increase terminal load immensely.
I have searched through the documentation, however I cant seem to find something like “OnActivated” or “If(Activated()==1)”.
Does anyone know of a solution or something I can read that may lead me down the right path?