Using support/resistance from higher time frame problem

Hello,

I am having problems with using daily pivot points intraday. I am trying to buy when

  1. pivot point today is higher than pivot point yesterday AND
  2. candle's low (on 1 minute time frame) is below pivot point.

I can get individual buys when using either of the rules, but not with both rules. The only exception is when the first candle of the day is below pivot point for that day.

Can someone tell me what am I doing wrong? Exploration results seem correct.

_N(Title = StrFormat(FullName() + "  {{INTERVAL}} {{DATE}} Open %g, High %g, Low %g, Close %g (%.1f%%) Volume " +WriteVal( V, 1.0 ) +"\n{{VALUES}}", O, H, L, C,
SelectedValue( ROC( C, 1 )) ));
PriceStyle = GetPriceStyle();
PriceStyleOpt = ParamStyle("Style") | PriceStyle;

// PIVOT POINTS
// Get prev day high, low, close

dh = TimeFrameGetPrice("H", inDaily, -1);
dl = TimeFrameGetPrice("L", inDaily, -1);
dc = TimeFrameGetPrice("C", inDaily, -1);

P = (dh + dl + dc)/3; //Pivot
R2 = P + (dh-dl); //Resistance 2
R1 = (P*2) - dl; // Resistance 1

S1 = (P*2) - dh; //Support 1
S2 = P - (dh-dl);//Support 2

// Contact with P0
bullish = IIf(P > Ref(P, -1), True, False);
contact = P > L;

Buy = bullish AND contact; //Buy Condition
Sell = TimeNum() > 155500; //Sell Condition

Buy = ExRem(Buy,Sell); //Removing Excessive Buy Signals At each bars
Sell = ExRem(Sell,Buy); //Removing Excessive Sell Signals at each bars


shape = Buy * shapeUpArrow + Sell * shapeDownArrow; 
PlotShapes( shape, IIf( Buy, colorGold, colorRed ), 0, IIf( Buy, Low, High ) ); 
Plot( C, "", colorBlack,styleCandle);
SetChartOptions( 0, chartShowDates );
Plot(P, "P0", colorAqua);

Filter = 1;
AddColumn(L, "Low"); 
AddColumn(P, "Daily Pivot"); 
AddColumn(P > L, "Contact");

I also tried using TimeFrameSet and Restore, and got the same exploration results.

Exploration

Does anyone know why exploration results might no be reflected on charts/backtests?

You should direct your first steps to the Knowledge Base
http://www.amibroker.com/kb/2015/01/28/why-analysis-results-and-chart-output-may-differ/

Hi

I just read the article you suggested. May I ask for a clarification on this option, as I cannot find anything on google:
"Pad and align data to reference symbol"

It means that if I have data holes, the CHART will automatically pad and fill the holes. ie if I have 1min bars base interval and the 10:27 bar is missing, the 5min chart with create a 5min bar at 10:25, which will include the data from the following 4 bars:
10:25
10:26
10:28
10:29

Am I right?

And then I need to tick the option "Pad and align data to reference symbol" to have the same effect in backtesting. Have I got it right?

No. All Analysis Window Settings, including "Pad and align...." apply to given Analysis Window only. Charts are independent from Analysis window. And chart does NOT do any padding.

Unless the current symbol in chart is the reference symbol and he use Foreign to access the data

Yes. To test this, I just deleted a bar from the quote editor and the chart just omits this bar. So if I delete the 1min bar at 10:27, then the chart will draw the following bars, without any holes :
10:25
10:26
10:28
10:29

And then the 5min bar at 10:25 combines the data from the above 4 bars. The 5min bar at 10:30 will combine the data from the following bars:
10:30
10:31
10:32
10:33
10:34

Is this correct?

I still do not understand what the following means. Could somebody point me to an article to read? Is there any example? (As I said I did not find anything in google)
"Pad and align data to reference symbol"
"Third thing to check is the Pad and align data to reference symbol option that may affect input data for Analysis window calculations if there are differences in quotes or timestamps between the analysed ticker and the reference symbol, so unchecking this option may be required:"

Have you read this article? It directly addresses some of your questions:

http://www.amibroker.org/userkb/2007/06/26/data-holes-in-real-time-trading/

Besides, when you access foreign security data using foreign( Ticker, Datafield, fixup = 1) pay special attention to the fixup parameter which is responsible for dealing with data holes:

https://www.amibroker.com/guide/afl/foreign.html7

1 Like

Thank you @Milosz

I have not delved into this area yet and I feel the need to do it.

In order to help other readers....

If you google "Pad and align data to reference symbol" you won't find much. Rather google for this:

"Pad and align" "reference symbol"