Daily scans in Weekly time frame

Hi,

I have a strategy that I am testing on the weekly time frame.

Something as simple as Buy = C > BuyLine (EMA, SMA or one of the bands) and opposite for the Sell.

When I run scans in real-time, I want to start seeing signals from Monday ( or first day of the week) onward which will finally be executed on Friday (or last day of the week).

But I run the scan on Monday (first day of the week) the signal only shows from Tuesday (or second day of the week) even though the Close is greater on First and Second day.

Please help me out with this. I would like to start seeing signals from the First day only.

Thank you.

You might want to clarify your issue with an example of the code and details of how you are running it (backtester settings etc), otherwise the forum contributors are going to be feeling around in the dark to try and understand what your issue could be.

See How to use this site.

1 Like

Hello,

Thank you for the response. Below is the example of the code.

_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 
_SECTION_END();

Line = EMA(C, 50);

Buy = Close > Line;
Sell = Close < Line;

Buy = ExRem(Buy, Sell);
Sell = ExRem(Sell, Buy);

Plot(Line, "EMALine", colorOrange, styleLine);
PlotShapes(shapeUpArrow*Buy, colorYellow);
PlotShapes(shapeDownArrow*Sell, colorYellow);

As mentioned earlier, I am running this scan on a Weekly time frame. The signals only appear in the scan from Tuesday (second day) and not from Monday (first day of the week) even though the conditions are met on both days.

I am adding a live example here. As you will see the chart is in Weekly time frame. Today is a Monday, below is the image of a symbol where Close of Monday is below the EMA. The down arrow is reflecting as well. But this signal does not appear in the scan. If the signal continues tomorrow (Tuesday) it will start showing in the scan.

I would like the scan to show signals on Monday. Could you help me with the issue?

Do let me know if you need more information.

Thank you.

image

Untitled

Settings.apx (7.4 KB)

In continuation to yesterdays post.

Today is a Tuesday, the current price of the symbol is below the EMA, as seen in the chart below. Although it was not showing in the scan yesterday (Monday, 16-Oct), it is showing in the scan today (Tuesday, 17-Oct).

I request somebody to help me with this issue. I need the weekly signals to start showing in the scan from Monday so that I can track them through the week.

Thank you.

image

Tuesday

I would create an Exploration that includes both your Close and EMA Line so that you can verify that the signal should be occurring in the context of an Analysis. For example, if you have Pad & Align turned on and there are holes in your data, the EMA may be different in a chart window than it is in an Analysis.

@TrendTrader Weekly system run on Weekly data will usually be set up to trade either on the Open or Close of the Week (typically Monday's Open or Friday's Close). Either in your code or via Backtester settings you should check what you have set for "Trade Delay's" .

https://www.amibroker.com/guide/afl/settradedelays.html

image

If you are using Daily data and are trying to test a Weekly system, then your code is all wrong.

@mradtke Thank you for the response.

Isn’t there a simpler way to do this?

I wonder this because if the same signal starts showing in the scan from Tuesday onward then why won’t it show on a Monday? And this occurs consistently with all symbols. I am pretty sure there is no issues with the data in all of them.

@quantboy Thank you for the response.

I have set the trades in Close with zero trade delay in the Backtester settings.

And yes, I am using Daiily data (EOD) for testing a Weekly system and haven’t found any issues with the results. Why do you suggest that the code is wrong?

@TrendTrader If you are using the Weekly settings for your backtests, why are you running tests on Monday and Tuesday ( and other days?)? Shouldn’t you be only running your tests once per week? I just do not understand what you are doing. Your first post you wrote
“When I run scans in real-time, I want to start seeing signals from Monday ( or first day of the week) onward which will finally be executed on Friday (or last day of the week).”

What do you mean by “real-time” and start seeing signals “onward”? A weekly system by definition is run once per week.

Have you set up daily or weekly in the backtester settings?
https://www.amibroker.com/guide/w_settings.html

You wrote that you are using daily data, but if you have correctly set up the backtester setting to run your system Weekly, then Amibroker is using WEEKLY data.

Are you using daily data and testing every day? If so HOW are you creating your “Weekly” indicators using the multiple time frame functions? I don’t see any in your code.
https://www.amibroker.com/guide/h_timeframe.html

1 Like

@quantboy Thank you for responding.

I am running scans through the week just to track signals. My execution is Weekly.

I have set up Weekly in backtester settings.

To explain again with an example. Let’s say the EMA level is 50. Buy is Close > EMA. On Monday Close is 50.25, Tuesday is 50.50, Wednesday is 50.4 … Friday is 50.75. So on all the days of the week, the condition has been met. I am just running a Weekly scan (with Weekly in backtester settings) to track the signal. The signal starts showing in the scan only from Tuesday and not Monday even though the condition has been met.

Why does it not show on Monday? Can this issue be resolved? I believe, it should be easy.

@HelixTrader @Tomasz Can you guys help me out with this? I have added sample code, settings and images in my previous posts.

If you are using WEEKLY input periodicity all output produced by Analysis will have WEEKLY datetime stamps that typically means FRIDAY (end of week), with the exception of very last incomplete bar (if week is half-way there, so if you run it on Tuesday you will get Tuesday timestamp for last bar if condition is met).

@Tomasz I am using WEEKLY periodicity. If the conditions are met on Monday, then why do the signals not show? They only start showing from Tuesday onward.

Maybe you just have one bar delay in the Settings. Or you are using Ref() or …what ever other reason is you may find using techniques presented here: How do I debug my formula?