help needed to edit pivot based buy-sell afl code

#1
this is the pivot based buy-sell afl code
i need it to be edited for perfect buy sell trading for auto trading
so plz someone help me sir
i need to make it buy signal at the moment when it touches buy target with green candle, same for sell when it touches sell target with red candle.
next i need to remember todays first made buy or sell signal not repeat same buy or sell signal.only to make a reverse sell or buy signal when it reaches it.
also it has problem at start of day it showing buy/sell signal on yesterday target before calulating todays target. need to avoid it.
hope u experienced gentlemen guys can help me easily.
Code:
SetPositionSize( 2000, spsShares ); // 2000 shares by default 
_SECTION_BEGIN("camarilla levels");
//---- pivot points
DayH = TimeFrameGetPrice("H", inDaily, -1);		// yesterdays high
DayL = TimeFrameGetPrice("L", inDaily, -1);		//				low
DayC = TimeFrameGetPrice("C", inDaily, -1);		//				close
DayO = TimeFrameGetPrice("O", inDaily,-1);			// current day open

if ( True )
{
A =  Optimize("X",Param("A",0.17,0.1,1,0.01),0.1,1,0.01);

R = DayH - DayL;	  // range
PP = (DayH + DayL +DayC+DayO)/4;
R1 = PP + (R * A);
S1 = PP - (R * A);
BT=R1+4*(R1-PP);
ST=S1-4*(PP-S1);
}

Plot(R1, "",colorGreen,styleStaircase);
Plot(S1, "",colorGreen,styleStaircase);
Plot(PP, "",colorBlue,styleDots+styleNoLine);
Plot(BT, "",colorBlue,styleDots+styleNoLine);
Plot(ST, "",colorBlue,styleDots+styleNoLine);



//----
Title = Name()+" SIMPLE PIVOT & FIBO"+Date()+ EncodeColor(colorRed)+"  Long Breakout above  "+WriteVal(R1,1.2)+"\n"+EncodeColor(colorRed)+"  Short breakout below  "+WriteVal(S1,1.2) 

;


Filter=1;
AddColumn(C,"cmp",1.2);
AddColumn(R1,"R4",1.2);
AddColumn(S1,"S4",1.2);
AddColumn(PP,"UP",1.2);
_SECTION_END();




Buy=Cover=Cross (C, R1);
Sell=Short= Cross (S1 ,C);

// plot arrows

shape = Buy * shapeUpArrow + Short * shapeDownArrow;
PlotShapes( shape, IIf( Buy, colorGreen, colorRed ), 0, IIf( Buy, Low, High ) );



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", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
 
#3
thanks for trying to help me
there is lot i need to edit in it sir
first problem is it should calulate only at start of 9.15
also i need the buy signal to show immediately when price touches r1 and like that sell signal when price touches s1 when the 1min candle is green for buy ,red for sell,
i dont know how to msg u privately sir if u can, contact me
 
#4
The camarilla levels can be changed.The changes cater to exact levels in current market.For example the current levels dont work perfectly ..... tweek the levels is such a way that it is adjusted to current mkt scenerio.Has anybody done it?
 
#5
SetPositionSize( 2000, spsShares ); // 2000 shares by default
_SECTION_BEGIN("camarilla levels");
//---- pivot points
DayH = TimeFrameGetPrice("H", inDaily, -1); // yesterdays high
DayL = TimeFrameGetPrice("L", inDaily, -1); // low
DayC = TimeFrameGetPrice("C", inDaily, -1); // close
DayO = TimeFrameGetPrice("O", inDaily,-1); // current day open

if ( True )
{
A = Optimize("X",Param("A",0.17,0.1,1,0.01),0.1,1,0.01);

R = DayH - DayL; // range
PP = (DayH + DayL +DayC+DayO)/4;
R1 = PP + (R * A);
S1 = PP - (R * A);
BT=R1+4*(R1-PP);
ST=S1-4*(PP-S1);
}

Plot(R1, "",colorGreen,styleStaircase);
Plot(S1, "",colorGreen,styleStaircase);
Plot(PP, "",colorBlue,styleDots+styleNoLine);
Plot(BT, "",colorBlue,styleDots+styleNoLine);
Plot(ST, "",colorBlue,styleDots+styleNoLine);



//----
Title = Name()+" SIMPLE PIVOT & FIBO"+Date()+ EncodeColor(colorRed)+" Long Breakout above "+WriteVal(R1,1.2)+"\n"+EncodeColor(colorRed)+" Short breakout below "+WriteVal(S1,1.2)

;


Filter=1;
AddColumn(C,"cmp",1.2);
AddColumn(R1,"R4",1.2);
AddColumn(S1,"S4",1.2);
AddColumn(PP,"UP",1.2);
_SECTION_END();




Buy=Cover=Cross (C, R1);
Sell=Short= Cross (S1 ,C);


Buy=ExRem(Buy,Short);
Short=ExRem(Short,Buy);
// plot arrows

shape = Buy * shapeUpArrow + Short * shapeDownArrow;
PlotShapes( shape, IIf( Buy, colorGreen, colorRed ), 0, IIf( Buy, Low, High ) );



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", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
 

Similar threads