Agra+India
Posts: 42 since Sep 2016
Thanks Given: 17
Thanks Received: 3
|
below is my simple stochastics strategy.i am using this on symphony presto amifuse trading on this bar close price.
i want the trades to take place on next bar open price. but not able to do so. i have also attached the code for presto amifuse- for signal generation.
please help me in getting signals on next bar open.
P=Param("Periods", 14, 5, 30, 1);
PD=Param("Oscillator Avg", 3, 3, 30, 1);
PD1=Param("Smooth1", 3, 3, 30, 1);
res=HHV(H,P);
sup=LLV(L,P);
avd=IIf(C>Ref(res,(RP*-1)), 1, IIf(C<Ref(sup,(RP*-1)), -1, 0));
avn=ValueWhen(avd!=0,avd,1);
tsl=IIf(avn==1,sup,res);
Plot(tsl, "trend", colorWhite, styleStaircase);
A=Close;
B=(A-LLV(L,P))/(HHV(H,P)-LLV(L,P));
D=MA(B,PD);
D1=MA(D, PD1);
Buy=((Cross(D, D1) AND avn==1));
Sell=D<D1;
Short=((Cross(D1, D) AND avn==-1));
Cover=D>D1;
Buy=ExRem(Buy, Sell);
Sell=ExRem(Sell, Buy);
Short=ExRem(Short, Cover);
Cover=ExRem(Cover, Short);
PlotShapes(IIf(LongSignal, shapeUpArrow, shapeNone), colorWhite);
PlotShapes(IIf(ShortSignal, shapeDownArrow, shapeNone), colorYellow);
PlotShapes(IIf(Sellsignal, shapeStar, shapeNone), colorYellow);
PlotShapes(IIf(CoverSignal, shapeStar, shapeNone), colorWhite);
_SECTION_BEGIN("presto1");
a2=(Sell);
a4=(Cover);
a1=(Buy);
a3=(Short);
a5=Ref(C,-1);
a6=Ref(C,-1);
a7=0;
if(a2[BarCount-2]==1)
{
SellToFuse(a5[BarCount-1],a6[BarCount-2]);
}
if(a4[BarCount-2]==1)
{
CoverToFuse(a5[BarCount-1],a6[BarCount-2]);
}
if(a1[BarCount-2]==1)
{
BuyToFuse(a5[BarCount-1],a7[BarCount-2]);
}
if(a3[BarCount-2]==1)
{
ShortToFuse(a6[BarCount-1],a7[BarCount-2]);
}
_SECTION_END();
|