Where do i get these down arrows from?

Here is my code and i see the yellwo arrows from line #52 which is the last line of the code. but i have no downarrow shape in that line. I am perplexed and could use your help. I plot this chart on a 5 minute chart.

intervaltimeframe = in5Minute;
wo = TimeFrameGetPrice( "O", intervaltimeframe * 5, 0, expandPoint );
wh = TimeFrameGetPrice( "H", intervaltimeframe * 5, 0, expandPoint );
wl = TimeFrameGetPrice( "L", intervaltimeframe * 5, 0, expandPoint );
wc = TimeFrameGetPrice( "C", intervaltimeframe * 5, 0, expandPoint );
PlotOHLC( wo, wh, wl, wc, "25 minute timeframe", colorWhite, styleCandle );

TimeFrameSet( intervaltimeframe * 5 ); // switch to 5 minute frame

/* MA now operates on 5 minute data, ma5_13 holds time-compressed 13 bar MA of 5min bars */
RANGEinhigh = H - L;
hh7 = RANGEinhigh  == HHV( RANGEinhigh, 7 );
nr7 = RANGEinhigh  == llv( RANGEinhigh, 7 );
atr15 = ATR( 14 );
engulfing = L < Ref( L, -1 ) AND H > Ref( H, -1 );
delta_h = H - Ref( H, -1 );
delta_l = Ref( l, -1 ) - l;

delta_l = delta_h - Ref( delta_h, -1 );
delta_s = delta_l - Ref( delta_l, -1 );
deltachange_l = delta_l > Ref( delta_l, -1 ) AND H > Ref( h, -1 );
deltachange_s = delta_s > Ref( delta_s, -1 )  AND L < Ref( L, -1 );
TimeFrameRestore(); // restore time frame to original
atr15_expanded = TimeFrameExpand( atr15, intervaltimeframe * 5, expandFirst );
hh7_expanded = TimeFrameExpand( hh7, intervaltimeframe * 5, expandPoint );
nr7_expanded = TimeFrameExpand( nr7, intervaltimeframe * 5, expandPoint );
deltachange_s_expanded = TimeFrameExpand( deltachange_s, intervaltimeframe * 5, expandPoint );
deltachange_l_expanded = TimeFrameExpand( deltachange_l, intervaltimeframe * 5, expandPoint );

// PlotShapes( nr7_expanded*shapeDigit7 , colorBlue, 0,wl+ (wh-wl)/12 );
engulfing_expanded = TimeFrameExpand( engulfing, intervaltimeframe * 5, expandPoint );
minute5range = H - L;
min5greterthanhighertimeframe = minute5range >  atr15_expanded;
PlotShapes( min5greterthanhighertimeframe * shapeStar , colorYellow, 0, wc );
PlotShapes( hh7_expanded*shapeDigit7 , colorYellow, 0, wl + ( wh - wl ) / 12 );
PlotShapes( engulfing_expanded*shapeSmallCircle , colorYellow, 0, wh + ATR( 2 ) );




Periods = 50;
ma50 = MA( c, Periods );

Periods = 200;
ma200 = MA( c, Periods );
highesthigh = IIf( ma50 > ma200, highestsince( Cross( ma50, ma200 ), h, 1 ) , highestsince( Cross( ma200, ma50 ), h, 1 ) ); // returns the highest close price since ma crossed
lowestlow = IIf( ma50 > ma200, lowestsince( Cross( ma50, ma200 ), l, 1 ) , lowestsince( Cross( ma200, ma50 ), l, 1 ) ); // returns the highest close price since ma crossed
color50 = IIf( ma50 < ma200 && ma50 >= Ref( ma50, -1 ) && Ref( ma50, -1 ) >= Ref( ma50, -2 ), colorOrange, colorYellow );
Plot( ma50  , _DEFAULT_NAME(), color50, styleLine );
Plot( ma200 , _DEFAULT_NAME(), colorGreen, styleLine );
PlotShapes( deltachange_l_expanded *shapeUpArrow * ( ma50 > ma200 ), colorYellow, 0, highesthigh + 2 * ATR( 14 ) );
PlotShapes( deltachange_s_expanded *shapestar * ( ma50 < ma200 ), colorYellow, 0, lowestlow - 2 * ATR( 14 ) ); //<<<where is the down arrow coming from?

https://i.imgur.com/FNP6MYY.png

In first 6 lines you get OHLC array of 25 m_Frame and in the line no 8 which you supposed to switch back to 5m_Frame
You did not pay attention that your time frame is still actually on 25m_Frame

TimeFrameSet( intervaltimeframe * 5 ); //Your Original Code
TimeFrameSet( intervaltimeframe * 1 ); // What it's supposed to be

the same can also be said for line no 27

my code was misleading you as I should have used Interval() in first line instead of hard coding in5minute.
Nonetheless, the problem is somewhere in the last line. I just switched it to
PlotShapes( IIf( ma50 < ma200 AND deltachange_s_expanded,shapestar,shapeNone), colorYellow, 0, lowestlow - 2 * ATR( 14 ) );
and it works properly. Yet, I don't see how this is different from the below line as I just moved the conditions to a iff statement.
PlotShapes( deltachange_s_expanded *shapestar * ( ma50 < ma200 ), colorYellow, 0, lowestlow - 2 * ATR( 14 ) );

IIf( ma50 < ma200 AND deltachange_s_expanded,shapestar,shapeNone)

The line above will always return shapestar OR shapeNone

deltachange_s_expanded * shapestar * ( ma50 < ma200 )

The line above will vary depending on deltachange_s_expanded and average condition
if 0 will return zero
if 1 will return shapestar
if greater than 1 and average condition is true (1) will return deltachange_s_expanded MULTIPLY by shapestar

1 Like