I seek two 3 day simple MA’s plotted as stepped lines on the chart, one calculated with High, other Low; to be used as an entry and trailing stop indicator and plotted when close triggers an uptrend or down trend
show plot script MAH = (Simple, high, 3 day); MAL = (Simple, low, 3 day);
thought an if statement could decipher between plots but both lines are plotted
The plot1 and plot2 lines will bypass the If statement and plot the functions they are assigned to. If the idea is to swap between the Low / High MA you need just 1 plot, the IF function will handle the swap between the two.
MAH = MA(BARS=3, CALC=High);
MAL = MA(BARS=3, CALC=Low);
plot1=IF(Close() < MAL, MAH,MAL);
plot1.Plotstyle = Step;
You can then setup the Show Plot to use a custom colour scheme so that when MAH is used it’s blue and MAL it’s red.
The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.