ksr
August 4, 2022, 3:30am
#1
Hi Folks,
I have searched the forum for plotting vertical lines on Buy/Sell signals, but could not find any to Only draw only the Most Recent Signal and do not plot the previous signals.
I have put the code below and also the image.
Need your help.
_SECTION_BEGIN( "trend_CROSS_VERTICALLINES_HIST" );
Trend = ema( close, 5 ) - ema( close, 20 );
Buy = TREND > 0 ;
Sell = TREND < 0;
Buy = ExRem(Buy, Sell);
Sell = ExRem(Sell, Buy);
Plot( 0, "", colorblack, styleLine | styleNoLabel );
Plot( Trend, "Trend", ColorBlack, styleLine|styleThick|styleNoLabel);
Plot(Trend, "Trend Hist", Colorcustom12, styleNoTitle|styleHistogram|styleNoLabel, maskHistogram ) ;
Plot( BUY, "Buy", ColorBlue, ParamStyle( "BUY.Style", styleNoTitle | styleHistogram | styleNoLabel | styleOwnScale, maskHistogram ) ) ;
Plot( SELL, "Sell", ColorRED, ParamStyle( "SELL.Style", styleNoTitle | styleHistogram | styleNoLabel | styleOwnScale, maskHistogram ) ) ;
_SECTION_END();
JohnHT
August 4, 2022, 5:12am
#2
Hi,
Staying with the same plot method perhaps something like this...
_SECTION_BEGIN( "trend_CROSS_VERTICALLINES_HIST" );
Trend = ema( close, 5 ) - ema( close, 20 );
Buy = TREND > 0 ;
Sell = TREND < 0;
Buy = ExRem( Buy, Sell );
Sell = ExRem( Sell, Buy );
Plot( 0, "", colorblack, styleLine | styleNoLabel );
Plot( Trend, "Trend", ColorBlack, styleLine | styleThick | styleNoLabel );
Plot( Trend, "Trend Hist", Colorcustom12, styleNoTitle | styleHistogram | styleNoLabel, maskHistogram ) ;
Bi = BarIndex();
BuySell = Buy OR Sell;
BuySellBars = BarsSince( BuySell );
LastBuySell = Bi == LastValue( Bi - BuySellBars ) AND BuySell;
Plot( LastBuySell, "LastBuyOrSell", IIf( Buy, colorBlue, colorRed ), ParamStyle( "BUY/SELL.Style", styleNoTitle | styleHistogram | styleNoLabel | styleOwnScale, maskHistogram ) );
//Plot( BUY, "Buy", ColorBlue, ParamStyle( "BUY.Style", styleNoTitle | styleHistogram | styleNoLabel | styleOwnScale, maskHistogram ) ) ;
//Plot( SELL, "Sell", ColorRED, ParamStyle( "SELL.Style", styleNoTitle | styleHistogram | styleNoLabel | styleOwnScale, maskHistogram ) ) ;
_SECTION_END();
2 Likes
ksr
August 4, 2022, 5:23am
#3
Dear John,
Thanks a ton, i had spent the whole day to search the forum for this.
Guess bane of a non-programmer.
Thank you so much and also the forum for having this platform and ecosystem to help each other.
system
Closed
November 12, 2022, 5:23am
#4
This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.