Simple Coding Help - No Promise.

bunti_k23

Well-Known Member
How to add the following cond in buy sell signals in any afl,
Buy if candle crosses R1(pivot point resistance 1) of signal candle,
Sell if candle crosses S1(pivot pointbsupport 1) of signal candle.
 
How to add the following cond in buy sell signals in any afl,
Buy if candle crosses R1(pivot point resistance 1) of signal candle,
Sell if candle crosses S1(pivot pointbsupport 1) of signal candle.
LONG = C>R1 ; //"R1" FROM PIVOT SYNTAX
SHORT = C<S1; // "S1" FROM PIVOT SYNTAX

BUY = ExRem(LONG,SHORT);
SELL = ExRem(SHORT,LONG);

// Before you have to assign R1 and S1 in the AFL // :D
 
Last edited:

toocool

Well-Known Member
Just a start.Need someone to work on your exact requirement.

http://www.wise stocktrad er.com/indicators/4079-mtf-ema-crossover
thanks @amitrandive

you rock bro , now just somethings needs to be edited


pd = Param("Period",5,1,200);
PEMA = MA((H+L+C)/3, pd);
Plot(PEMA, "Pivot EMA", paramColor("PEMA color", colorBlue));

i need this code added in afl instead of EMA , i need it as a 2 pivot MA crossover system , also period selection button is not there in afl , that also is needed .

hopefully master coders can do that :thumb:
 

Nehal_s143

Well-Known Member
How to add the following cond in buy sell signals in any afl,
Buy if candle crosses R1(pivot point resistance 1) of signal candle,
Sell if candle crosses S1(pivot pointbsupport 1) of signal candle.
Code:
_SECTION_BEGIN("Daily Levels");


DayH = TimeFrameGetPrice("H", inDaily, -1);		// yesterdays high
DayL = TimeFrameGetPrice("L", inDaily, -1);		//low
DayC = TimeFrameGetPrice("C", inDaily, -1);		//close
DayO = TimeFrameGetPrice("O", inDaily);			// current day open


if ( True )
{
PP = (DayH + DayL + Dayc)/3;
R1  =  (2*PP) - DayL;
S1  =  (2*PP) - DayH;
R2  =  PP + (DayH - DayL);
S2  =  PP - (DayH - DayL);
R3  =  R1 + (DayH - DayL);
S3  =  S1 - (DayH - DayL);
}


// PARAMETERS
SHALD = ParamList("daily Pivots", "selected only|all|hide" );

//day
PDP = ParamList("PP",   "SHOW|HIDE" ); 
PDR1 = ParamList("R1", "SHOW|HIDE" ); 
PDR2 = ParamList("R2", "HIDE|SHOW"  ); 
PDR3 = ParamList("R3", "HIDE|SHOW" ); 

PDS1 = ParamList("S1", "SHOW|HIDE" ); 
PDS2 = ParamList("S2", "HIDE|SHOW" ); 
PDS3 = ParamList("S3", "HIDE|SHOW" ); 

DayCOLOR = 34;

/*--------------------------------------*/
// PLOTS
 style = IIf(ParamList("Chart style",
"styleCandle|styleBar")=="styleCandle",64,128);
 Plot (C,Date ()+" close",11,style);
 //day
 if ((PDP=="SHOW" OR SHALD=="all")  && SHALD!="hide") Plot (pp,"daily Pivot
",DayCOLOR,1);
 if ((PDR1=="SHOW" OR SHALD=="all") && SHALD!="hide") Plot (r1,"daily R1
",DayCOLOR,32);
 if ((PDR2=="SHOW" OR SHALD=="all") && SHALD!="hide") Plot (r2,"daily R2
",DayCOLOR,32);
 if ((PDR3=="SHOW" OR SHALD=="all") && SHALD!="hide") Plot (r3,"daily R3
",DayCOLOR,32);

 if ((PDS1=="SHOW" OR SHALD=="all") && SHALD!="hide") Plot (s1,"daily S1
",DayCOLOR,32);
 if ((PDS2=="SHOW" OR SHALD=="all") && SHALD!="hide") Plot (S2,"daily S2
",DayCOLOR,32);
 if ((PDS3=="SHOW" OR SHALD=="all") && SHALD!="hide") Plot (S3,"daily S3
",DayCOLOR,32);

Buy =   C>O AND  C>R1;
Sell =  C<R1;
Short = C<O AND  C<S1;
Cover = C>s1;

Buy=ExRem(Buy,Sell);
Short=ExRem(Short,Cover);
Sell=ExRem(Sell,Buy);
Cover=ExRem(Cover,Short);

PlotShapes(Buy*shapeUpArrow,colorBlue,0,L,-60);
PlotShapes(Sell*shapeHollowDownArrow,colorRed,0,L,-51);
PlotShapes(Short*shapeDownArrow,colorRed,0,H,-60);
PlotShapes(Cover*shapeHollowUpArrow,colorBlue,0,H,-51);



_SECTION_END();
 

Similar threads