afl for sequential trade stratagies

_

in this code i need help

what happens is
suppose buy signal came at 09300 hrs , as per strategy, buy value of open is assigned , if there is no sell signal in between 09300 & 094500 , buy will again generated & new buy value will be assigned , i don’t want this to happen,
EVEN IF EXREM IS USED THE SIGNAL DISAPPEARS BUT BUY VALUE CHANGES.

AFL IS SYNTAX WISE OK U MAY RUN &SEE ,
///////////////
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();
// Downloaded From www.WiseStockTrader.com

SetTradeDelays(0,0,0,0);
Buy2=Cross (RSI(30),40) OR Cross (RSI(30),55);

//TimeNum()>092000 AND TimeNum()<152000 AND (C>100 AND C<200);
Buy1= Cross(TimeNum(),092500)
OR Cross(TimeNum(),093000)
OR Cross(TimeNum(),094500)
OR Cross(TimeNum(),100000)
OR Cross(TimeNum(),101500)
OR Cross(TimeNum(),103000)
OR Cross(TimeNum(),113000)
OR Cross(TimeNum(),123000)
OR Cross(TimeNum(),133000)
OR Cross(TimeNum(),143000)
OR Cross(TimeNum(),144900)
OR Cross(TimeNum(),150300)
OR Cross(TimeNum(),100000)
OR Cross(TimeNum(),110000)
OR Cross(TimeNum(),120000)
OR Cross(TimeNum(),130000)
OR Cross(TimeNum(),140000)
OR Cross(TimeNum(),145700)
OR Cross(TimeNum(),110000)
OR Cross(TimeNum(),120000)
OR Cross(TimeNum(),130000)

OR Cross(TimeNum(),150000);

Buy=Buy1;// AND Buy2;
bv=ValueWhen (Buy,O) ;
bv1=bv;
xx=ValueWhen(Buy,O);
tgt1= Cross((bv+10),C)OR Cross((bv+30),C)OR Cross((bv+40),C )OR Cross((bv+50),C)OR Cross((bv+60),C) OR H>(bv+70);// OR TimeNum()>152500;

Sell= TimeNum()>152500 OR L<(bv-10) OR tgt1; // SL TGT & SQUREOFF AT 152500

Plot( bv1, “bv”, colorWhite);
Plot( bv1-10, “sl”, colorRed);
Plot( bv1+40, “tgt”, colorGreen);
Plot( bv1+20, “tgt1”, colorYellow);
Plot( bv1+30, “tgt2”, colorGold);
Plot( bv1+10, “tgt”, colorGreen);

Buy=ExRem(Buy ,Sell);
Sell =ExRem(Sell,Buy);
PlotShapes( IIf( Buy, shapeUpArrow, shapeNone ), colorWhite, 0, L, Offset =-45 );
PlotShapes( IIf( Sell, shapeDownArrow, shapeNone ), colorCustom10, 0, H, Offset =-45);

_SECTION_END();

_SECTION_BEGIN(“MA1”);
P = ParamField(“Price field”,-1);
Periods = Param(“Periods”, 15, 2, 300, 1, 10 );
Plot( MA( P, Periods ), _DEFAULT_NAME(), ParamColor( “Color”, colorCycle ), ParamStyle(“Style”) );
_SECTION_END();

1 Like