I have another question which makes me crazy about the logic how Zorro handles BarOffsets with Pricedata. Here is an example code and a picture to compare.

this is only an experiment to understand the logic. i took the The7 Strategy Signals.

So the Strategie says for a Short Position. Check if OPEN of the last Candle (priceOpen(1)) is above than EMA_High(1) AND the CLOSE of the last candle (priceClose(1)) is below EMA_High(1) AND the CLOSE of the last candle (priceClose(1)) is above EMA_Low(1).

So here is the code and compare the TimeOffset in the two codes:

Code:
function run()
{
	StartDate = 2012;
	BarPeriod = 60;
	var* priceH = series(priceHigh());
	var* priceL = series(priceLow());
	var *EMAHigh = series(EMA(priceH,5));
	var *EMALow = series(EMA(priceL, 5));
	
	
	//Short 0
	if(priceOpen(1) > EMAHigh[0]
	and priceClose(1) < EMAHigh[1]
	and priceClose(1) > EMALow[1])
	{
		enterShort();
	}
        PlotBars  =150;
	plot("EMAH", EMAHigh[0], 0, BLUE);
	plot("EMAL", EMALow[0], 0, BLUE);
}



And here is the resulting picture. Interesting to see, that the orders are 1 Candle too late.




But if i change the code-logic, which makes me trouble in my head, to this:

Code:
function run()
{
	StartDate = 2012;
	BarPeriod = 60;
	var* priceH = series(priceHigh());
	var* priceL = series(priceLow());
	var *EMAHigh = series(EMA(priceH,5));
	var *EMALow = series(EMA(priceL, 5));
	
	
	//Short 0
	if(priceOpen(0) > EMAHigh[0]
	and priceClose(0) < EMAHigh[0]
	and priceClose(0) > EMALow[0])
	{
		enterShort();
	}
	PlotBars  =150;
	plot("EMAH", EMAHigh[0], 0, BLUE);
	plot("EMAL", EMALow[0], 0, BLUE);
}



Then the results are like in this picture:



And the Orders are exactly at the candle, where they shoudl be.
I don't understand this logic, cause like in the first code, this is how MT4 handles the logic naturally:

MT4:
1. If new candle opens
2. check conditions on last candle, for example MT4-Code: High[1]
3. execute Order on actuall candle with the next tick

Zorro:
1. exactly at close of actual candle
2. check conditions on this candle, which is like the recent last candle in MT4, Zorro: priceHigh(0)
3. execute order on new candle with first tick.

Overall, this is a turnaround in my head. I see problems with some logics, where a trade must be executed on the actual candle (!)befor it closes. for example the actual candle reaches a defined body-size, which implies it as an impulsive candle and i'd like to trade it immediatly instead waiting for candle close.
I read in the manual, that if Zorro is in TRADINGMODE, that the Orderexecution is TICK-based, but how could i calculate the Body from the recent Open to the actual Tick-Price?
This could not be possible, because priceOpen(0) gives me the Openprice of the already closed candle (Open(1) in MT4)

i hope that someone understand what i try to explain here.

Last edited by PriNova; 11/20/12 19:37.