Plot not drawn on Daily and higher Timeframe

I am trying to use William's Fractal system and found several code on the internet.
I try to compile those code together like this:

_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();


_SECTION_BEGIN("BW Alligator");
/*** The trend indicators ***/

P= ParamList("Price", "Close|(H+L)/2|(H+C+L)/3",1);

if (P=="Close")
   A = C;
   
else
if (P=="(H+C+L)/3")
   A = (H+C+L)/3;
else
  A = (H+L)/2;

AlligatorJaw   = Ref(Wilders(A,13),-8);
AlligatorTeeth = Ref(Wilders(A,8), -5);
AlligatorLips  = Ref(Wilders(A,5), -3);

Plot(AlligatorJaw,  "Jaw", ParamColor("Jaw's Color",colorBlue), ParamStyle("Jaw's Style", styleThick));
Plot(AlligatorTeeth,"Teeth", ParamColor("Teeth's Color",colorRed), ParamStyle("Teeth's Style", styleThick));
Plot(AlligatorLips, "Lips", ParamColor("Lips's Color",colorGreen), ParamStyle("Lips's Style", styleThick));

_SECTION_END();

_SECTION_BEGIN("BW Fractal");

UpFractal= ValueWhen(
  (Ref(H,-2) > Ref(H, -4)) AND
  (Ref(H,-2) > Ref(H, -3)) AND
  (Ref(H,-2) > Ref(H, -1)) AND
  (Ref(H,-2) > H), Ref(H,-2));

DownFractal= ValueWhen(
  (Ref(L,-2) <= Ref(L, -4)) AND
  (Ref(L,-2) <=  Ref(L, -3)) AND
  (Ref(L,-2) <=  Ref(L, -1)) AND
  (Ref(L,-2) <=  L), Ref(L,-2));



//== Added Crash  crashandburn59 [at] hotmail.com solution
Plot(Ref(UpFractal,2), "Up Fractal", ParamColor("Up Fractal Color",colorRed), ParamStyle("Up Fractal Style", styleDashed));
Plot(Ref(DownFractal,2), "Down Fractal",ParamColor("Down Fractal Color",colorBlue), ParamStyle("Down Fractal Style", styleDashed));

//Plot(Max(HHV(H,3),Ref(UpFractal,2)), "Up Fractal", ParamColor("Up Fractal Color",colorRed), ParamStyle("Up Fractal Style", styleDashed));
//Plot(Max(HHV(H,3),Ref(UpFractal,2)), "Down Fractal",ParamColor("Down Fractal Color",colorBlue), ParamStyle("Down Fractal Style", styleDashed));

_SECTION_END();

_SECTION_BEGIN("AO and AC");
// AO dan AC
AOFast	= MA( A, 5 );
AOSlow	= MA( A, 34 );
AO 		= AOFast - AOSlow;
AC		= AO - MA( AO, 5 );
AOUB	= AO > Ref( AO, -1 );
AODB	= AO < Ref( AO, -1 );
ACUB	= AC > Ref( AC, -1 );
ACDB	= AC < Ref( AC, -1 );
GrnBar	= AOUB AND ACUB;
RedBar	= AODB AND ACDB;

// WiseMan
WM1L 	= L < Ref( L, -1 ) AND C > ( ( H + L ) / 2 ) AND AODB AND AO < 0 AND ( O < Ref( AlligatorTeeth, -5 ) AND C < Ref( AlligatorTeeth, -5 ) ) AND ( L < Ref( AlligatorTeeth, -5 ) AND H < Ref( AlligatorTeeth, -5 ) );
WM1S	= H > Ref( H, -1 ) AND C < ( ( H + L ) / 2 ) AND AOUB AND AO > 0 AND ( O > Ref( AlligatorTeeth, -5 ) AND C > Ref( AlligatorTeeth, -5 ) ) AND ( L > Ref( AlligatorTeeth, -5 ) AND H > Ref( AlligatorTeeth, -5 ) );
WM2L	= Ref( AODB, -3 ) AND Ref( AOUB, -2 ) AND Ref( AOUB, -1 ) AND AOUB;
WM2S	= Ref( AOUB, -3 ) AND Ref( AODB, -2 ) AND Ref( AODB, -1 ) AND AODB;
WM3L	= Cross( C, UpFractal );
WM3S	= Cross( DownFractal, C );
//PlotShapes( IIf( WM2L AND WM3L, shapeDigit4, IIf( WM1L, shapeDigit1, IIf( WM2L, shapeDigit2, IIf( WM3L, shapeDigit3, 0 )  ) ), colorGreen, 0, L, -10 );

PlotShapes( IIf( WM1L, shapeDigit1, IIf( WM2L, shapeDigit2, IIf( WM3L, shapeDigit3, 0 ) ) ), colorGreen, 0, L, -10 );
//PlotShapes( IIf( WM1S, shapeDigit1, 0 ) , colorRed, 0, H, 10 );
PlotShapes( IIf( WM1S, shapeDigit1, IIf( WM2S, shapeDigit2, IIf( WM3S, shapeDigit3, 0 ) ) ), colorRed, 0, H, 10 );

Buy = (WM3L) AND (AlligatorTeeth > AlligatorJaw) AND (AlligatorLips>AlligatorTeeth) AND (C>Ref(O,-1));
PlotShapes(IIf(Buy,shapeUpArrow,shapeNone),colorWhite,1,L*0.96);
_SECTION_END();

The code works fine to draw white arrow shape for my buy signal on intraday timeframe.
However, it is not working on Daily and higher timeframe.
Can anyone help me?

@Griffin, I had no time to examine the posted formula in detail, but the easiest way to find what's going on is to create use an exploration to debug to verify the values generated by the code.

For instance, add to the code:

Filter = 1;
AddColumn(Buy, "Buy", 1);
AddColumn(AlligatorTeeth, "Allligator Teeth");
AddColumn(AlligatorJaw, "Allligator Teeth");
AddColumn(AlligatorTeeth > AlligatorJaw, "Teeth > Jaw", 1);
AddColumn(AlligatorLips, "Allligator Lips");
AddColumn(AlligatorLips > AlligatorTeeth, "Lips > Teeth", 1);
AddColumn(C, "Close");
AddColumn(Ref(O,-1), "ref(open,-1)");
AddColumn(C>Ref(O,-1), "C > Ref(0,-1)", 1);
AddColumn(UpFractal, "UpFractal", 1);
AddColumn(WM3L, "WM3L");

I simply tried the formula against a common USA stock on a daily interval and I saw that the WM3L variable, used to set the Buy seems to happen very rarely (and in such a case you'll almost never see a buy signal).

In general, to better understand what is happening in your code use the advice and tools given here: How do I debug my formula?

Hi @beppe
Thank you for giving your time replying my thread.
I did do debugging and found that nothing is wrong with the code.
It even plot on intraday timeframe.
The problem occur only when on daily and higher timeframe, where there is no plot of my Buy condition (white arrow shape in this case).

And I got my answer after posting on other forum.
The result of my not drawn plots is due to setting on the chart visibility under layers.
Somehow, the daily and higher timeframe is not ticked.

@Griffin, that observation is correct.

Indeed your white arrows PlotShapes() line is set to a different layer (I missed this detail):

PlotShapes(IIf(Buy,shapeUpArrow,shapeNone),colorWhite,1,L*0.96);

It uses a 1 value for the "layer" (all the others are set to 0). Try changing it to 0 (the default layer):

PlotShapes(IIf(Buy,shapeUpArrow,shapeNone),colorWhite,0,L*0.96);

Using Layers, their significance and their configuration is explained here.

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.