Thanks jcl,

By comparing two trades….but before that , my complete code


int profit(){

if(TradeIsOpen and (TradeProfit/TradeUnits/PIP < -10)&& TradeIsShort){exitTrade();}
if(TradeIsOpen and (TradeProfit/TradeUnits/PIP >10)&& TradeIsShort){exitTrade();}
return 0;
}


function run() {

set(PARAMETERS+TICKS+LOGFILE);

StartDate = 20191215;
EndDate = 20191220;
BarPeriod = 60; //BarPeriod=1;

asset("NZD/CHF");

if (lhour(WET)==22 && minute(WET)==0){enterShort(profit);}

if (lhour(WET)==06 && minute(WET)==0){exitTrade();}

}

I can oberve that the prices entershort and exit are different if I use different barPeriod, but Ithought that it will be the same because :

"In the backtest, the result of entering a trade can be either a pending trade, an opened trade, or a skipped trade. If no Entry limit is given, trades are opened at the current price or at the next open price, dependent on Fill mode. If a trade is pending, Zorro continues to attempt opening the trade within the time period given by EntryTime."


"A trade management function (TMF) is automatically called every tick - i.e. whenever the price changes - with the the optional variables (v0 .. v7) as arguments. It can evaluate the current price and other trade variables for closing the position or adjusting stop and profit limits"



Every tick is called function TMF and the trades open at the current Price...isn't it ? So why the difference ?


Another question..with my code only I want to know if the 22:00 is a good hour for openShort and get 10 PIPS, how could I do that ? Can you explain me that my code is doing ?

Maybe I don't understand all but Im going crazy.

Thanks a lot and I wait your answer.




Last edited by sdelatorre; 12/25/19 17:55.