Going to need more details than that lol.
Latest posts made by Justoshow
-
~~Help - For Each Closed Trade~~ (SOLVED)posted in Questions & Answers
Hello All, I need a little guidance here. I have this MQL4 code that I'm trying to figure out how to replicate here. I'm trying to figure out how to use the "i" variable equivalent in the For Each Closed Trade block.
Code:
for(int i=1; i<=OrdersHistoryTotal(); i++)
{
if(OrderSelect(i-1,SELECT_BY_POS,MODE_HISTORY)==true)
{
if(OrderClosePrice()==OrderStopLoss())
loss++;
if(OrderClosePrice()==OrderTakeProfit())
win++;
if(OrderClosePrice()!=OrderStopLoss()&&OrderClosePrice()!=OrderTakeProfit())
exit++;
}
}It basically loops through the order history to see if the trade hit TP, SL, or Exited due to a Indicator giving the signal to go the other way. (I'm testing indicators the NNFX way) I'm using this to store the testing data and writing it to a file. This allows me to test many pairs on many different indicator settings and have the data in one file.
Any help is appreciated!
https://fxdreema.com/shared/kjEvsq2kb
Solution: I didn't even need to use the if(OrderSelect(i-1,SELECT_BY_POS,MODE_HISTORY)==true) statement. Works as is.