plot and calculate signal only during regulate trading hours

Posted By: rvl

plot and calculate signal only during regulate trading hours - 07/23/23 03:31

hello all,

After 2-weeks researching different Algo platforms to settle on, and like Zorro capacities and bought the S license. smile

Anyway, I'm still having a little hard time understanding BarZone and BarMode concepts even afer reading some posts on here. Basically, I have TICK t1 data from Sierra Chart in EST timezone, I want to plot and calculate ADX/ATR/etc only for the bars in regular trading hours only, discarding after-hours bars, but the plot still shows after-hours bars. My snippet is below, appreciate any help.

set(TICKS);
History = "History\\_2023.t1";
set(LOGFILE);
//series()
asset("QQQ");
//ADXs = series(ADX(20),20);
BarZone = UTC;

AssetMarketZone = EST;
AssetMarketStart = 0930;
AssetMarketEnd = 1600;
BarMode = BR_WEEKEND | BR_LOCAL | BR_MARKET;
//TickTime = 1;
LookBack = 80;
BarPeriod = 5;
StartDate = 20230710;
EndDate = 20230721;

StartMarket = 1330;
EndMarket = 2000;
Posted By: rvl

Re: plot and calculate signal only during regulate trading hours - 07/24/23 02:42

the graph in UTC time attached shows after-market data that I'm trying to discard, struggling with the Zorro's fundamental, HELP! thx

Attached picture aftermarketData.png
Posted By: bigsmack

Re: plot and calculate signal only during regulate trading hours - 07/31/23 14:33

There is a tiny example buried in the docs for the suspended function that may help. Please update this post if this works for you or not.

// don't shift series outside market hours
if(suspended()&8) set(NOSHIFT); else set(NOSHIFT|OFF);
Posted By: rvl

Re: plot and calculate signal only during regulate trading hours - 08/04/23 06:27

Thanks for the reply. I was able to get help from support. The issue is the order of the codes.The bars mode should be above the bars being generated.

I was able to get the chart aligned on UTC time but now next issue, the plot shows a giant bar between previous day's close and today's open as shown in the attached. I suspect because of these giant bars between daily close and open, I could not get a simple ATR calculation to match with Sierra Chart( where the data is from) or Tradingview. Any Idea? Thx

Attached picture Capture.PNG
Posted By: rvl

Re: plot and calculate signal only during regulate trading hours - 08/10/23 05:00

Just an update to this thread to share experience in case another new user of Zorro like me running into similar issue.

So I had to develop another script to remove the pre-market and after-market ticks from the data file to produce the plot, OHLC, ATR values "closely" matched to what Sierra Chart (where the data is from) show.

Another minor issue, looks like the run() function is executed about 500ms off of the market open time set in StartMarket, therefore it misses a few ticks, hence OHL values are slightly off.
© 2024 lite-C Forums