English

Calculate lowest tick since price break when backtesting?

 113 pontuso 2015.09.23 13:11   HiI want to calculate drawdown between bars (Starting from the bar that breaked the price) relative to the value 1.0000 Example "SEE ATTACHED PIC BELOW": My EA buys when price brakes 1.0000 ! at time  15:30:0515:30:45 / The price has moved down to 0.950015:30:55 / The price has moved up above 1.000 again15:31:25 / A new bar has formed and lowest of that bar is 0.9700At this point, at current bar the drawdown since breaking the price should be 1.0000 minus 0.9500 witch is 0.0500But when i use M1 history data the candle that broke the value 1.0000 has a low for example of 0.9300  the drawdown will be 1.0000 minus 0.9300 witch is 0.0700   -Witch offcourse is wrong the acual is 0.0500What i use now is:`Low[iLowest(NULL,0,MODE_LOW,shift_of_bar_that_crossed_the_price,0)]`But as i mentioned before it gives me wrong drawdown becuase - It takes the lowest value of bar that crossed the value 1.0000 //WrongInstead of what value i need... that would be:- The lowest value since crossed the value 1.0000  //CorrectSo how do i build a function that will understand this, and somehow stores and print the lowest BID tick value of a certain bar. (I already have the correct shift value of the bar "shift_bar_that_crossed_the _price")
 12998 WHRoeder 2015.09.23 13:39 #   pontuso:What i use now is:`Low[iLowest(NULL,0,MODE_LOW,shift_of_bar_that_crossed_the_price,0)]`So how do i build a function that will understand this, and somehow stores and print the lowest BID tick value of a certain bar. (I already have the correct shift value of the bar "shift_bar_that_crossed_the _price")The shift_of_bar_that_crossed_the_price is wrong. iLowest needs the bar count, which is last - first + 1. You have last=shift_of_bar_that_crossed_the_price and first=0.The lowest Bid is the Low of the bar.