Required help for Buy/Sell signal Supertrend

#1
Hello friend,
Below is my code but i'don't know how to add buy sell code in this, Can anyone help me in this.
I know it's big & expeties person comunity, plz help me

Required Buy = When Trend is up
Sell = When Trend is Down

---------------------------------------------------------

_SECTION_BEGIN("Supertrend AFL");

SetChartOptions(0,chartShowArrows|chartShowDates);

SetBarFillColor(IIf(C>O,ParamColor("UP Color", colorGreen),IIf(C<=O,ParamColor("Down Color", colorRed),colorLightGrey)));
Plot(C,"Price",IIf(C>O,ParamColor("Wick UP Color", colorLime),IIf(C<=O,ParamColor("Wick Down Color", colorOrange),colorLightGrey)),styleCandle | styleNoTitle);


_N(Title = "Supertrend AFL\n" + StrFormat("{{INTERVAL}} {{DATE}} \nOpen= %g, HiGH= %g, LoW= %g, Close= %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));



///////////////////////////////////////////// SUPERTRENT FUNCTION /////////////////////////////////////
function FunctionST (Period, Multiplier)
{
ATR_Val=ATR(Period);

UpperBand=LowerBand=final_UpperBand=final_LowerBand=SuperTrend=0;


///////// CALCULATE SUPERTRENT //////////
for( i = Period; i < BarCount; i++ )
{
UpperBand=((High + Low)/2) + Multiplier*ATR_Val;
LowerBand=((High + Low)/2) - Multiplier*ATR_Val;
final_UpperBand = IIf( ((UpperBand<final_UpperBand[i-1]) OR (Close[i-1]>final_UpperBand[i-1])), (UpperBand), final_UpperBand[i-1]);
final_LowerBand = Iif( ((LowerBand>final_LowerBand[i-1]) OR (Close[i-1]<final_LowerBand[i-1])), (LowerBand), final_LowerBand[i-1]);

SuperTrend = IIf(((SuperTrend[i-1]==final_UpperBand[i-1]) AND (Close<=final_UpperBand)),final_UpperBand,
IIf(((SuperTrend[i-1]==final_UpperBand[i-1]) AND (Close>=final_UpperBand)),final_LowerBand,
IIf(((SuperTrend[i-1]==final_LowerBand[i-1]) AND (Close>=final_LowerBand)),final_LowerBand,
IIf(((SuperTrend[i-1]==final_LowerBand[i-1]) AND (Close<=final_LowerBand)),final_UpperBand,0))));

}
Plot( SuperTrend, "SuperTrend", (IIf( SuperTrend>Close, ParamColor("Resistance", colorRed ), ParamColor( "Support", colorGreen ))), ParamStyle("Style") | styleThick | styleLine );
Return SuperTrend;
}


Periods_set = Param("Periods", 7, 1, 50 );
Multiplier_set = Param("Multiplier ", 1, 1, 10 );
Multiplier = Multiplier_set;
Period = Periods_set ;

SuperTrend = FunctionST(Period,Multiplier);


_SECTION_END();

---------------------------------
 

Similar threads

Zerodha – Open Paperless Account

Open online account with Zerodha. Free delivery trading and Max Rs 20 for Intraday, F&O, Currency and Commodity Trading. Intraday High leverage with MIS, CO and BO.

Name:Phone:
Email:City:
State:
Are you a day trader?