Unexpected behavior of AssetFrame

Posted By: boatman

Unexpected behavior of AssetFrame - 02/28/16 19:24

I set up daily bars aligned to different time zones dependent on the asset. Following the advice in the manual, the code below sets up the daily bars as expected - you can see in the plot the change of day occurring when the filter changes its value. So far so good.

What's unexpected is that setting ExitTime=2 causes trades to exit after 1 hourly bar, not after 1 daily bar.

Is this indeed unexpected behavior or am I missing something? What other functions react to the BarPeriod as opposed to the AssetFrame?
Code:
function run() 
{
   set(LOGFILE);

	BarPeriod = 60;
	LookBack = 200;
  	StartDate = 20151001; 
  	EndDate = 20151201;
  		
`	while(asset(loop("EUR/USD", "EUR/CAD", "AUD/USD")))   { 
		if(Asset == "EUR/USD" or Asset == "EUR/CAD") {
			FrameOffset = 9;
			AssetZone = ET;
		
		}
		else if(Asset == "AUD/USD") {
			FrameOffset = 17;
			AssetZone = JST;
		}
		
		TimeFrame = AssetFrame; 
		
		vars Price = series(price());
		vars filt = series(LowPass(Price, 50));
		
		ExitTime = 2;
		if (valley(filt)) enterLong();
		if (peak(filt)) enterShort();
		
		plot("filt", filt, MAIN, BLUE);
	}
}



Posted By: jcl

Re: Unexpected behavior of AssetFrame - 02/29/16 06:42

ExitTime is independent of the TimeFrame, it's always in bar period units.

If you want to exit in sync with the time frame, check the sign of AssetFrame.
Posted By: boatman

Re: Unexpected behavior of AssetFrame - 03/01/16 06:13

Gotcha. Would I be correct in assuming that all of the system variables that take a time period as input are dependent on BarPeriod, not TimeFrame? And that the price-based variables are dependent on time frame?

For example, EntryDelay for the former case and price() for the latter?
Posted By: jcl

Re: Unexpected behavior of AssetFrame - 03/01/16 11:00

Yes. If not mentioned otherwise, time variables are in bar period units.
Posted By: boatman

Re: Unexpected behavior of AssetFrame - 03/01/16 21:37

Thanks for clearing that up!
© 2024 lite-C Forums