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?
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); } }