fxDreema

    • Register
    • Login
    • Search
    • Back to the main page
    • Categories
    • Recent
    • Tags
    • Popular
    • Search

    ~~Help - For Each Closed Trade~~ (SOLVED)

    Questions & Answers
    1
    1
    269
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • J
      Justoshow last edited by Justoshow

      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.

      1 Reply Last reply Reply Quote 0
      • 1 / 1
      • First post
        Last post

      Online Users

      S
      C
      M
      J
      5
      C

      15
      Online

      146.7k
      Users

      22.4k
      Topics

      122.6k
      Posts

      Powered by NodeBB Forums | Contributors