0% found this document useful (0 votes)
77 views12 pages

Abkp Pop Ups

This document defines parameters and functions for plotting pivot points and identifying pivot trends on a chart. It calculates key pivot point indicators, identifies pivot point crosses, and plots the pivot points and trend lines on the chart.

Uploaded by

bharatbaba363
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
77 views12 pages

Abkp Pop Ups

This document defines parameters and functions for plotting pivot points and identifying pivot trends on a chart. It calculates key pivot point indicators, identifies pivot point crosses, and plots the pivot points and trend lines on the chart.

Uploaded by

bharatbaba363
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 12

_SECTION_BEGIN("ABKPPivotAndPops");

SetBarsRequired(350, -0);

//user parameters
parmPlotScoreCard = ParamToggle("Plot KPScoreCard", "No|Yes", 1);
parmPlotA900AutoStop = ParamToggle("Plot A900/AutoStop", "No|Yes", 1);
parmA900Color = ParamColor("A900 Color", colorWhite);
parmA900Style = ParamStyle("A900 Style", styleNoLine, maskAll);
parmAutoStopColor = ParamColor("AutoStop Color", colorCustom13);
parmAutoStopStyle = ParamStyle("AutoStop Style", styleLine, maskAll);
parmPPTextColor = ParamColor("PP Text color", colorBlack);
parmPPTrndColorUp = ParamColor("PP Trend Up color", colorGreen );
parmPPTrndColorDn = ParamColor("PP Trend Dwn color", colorRed);
parmPPTextOffSet = Param("PP OffSet", 0.90, 0.40, 1.5, 0.1);
parmTickMultipler = Param("M/W tick allowance", 0, 0, 10, 1);
parmA900AutoStopX = ParamToggle("Plot A900/AutoStop Cross", "No|Yes");
parmA900AutoStopColorX = ParamColor("A900/AutoStop Cross Color", colorBlack);
ParmSCThreshold = Param("ScoreCard Threshold", 5, 1, 9, 1);
parmVoice = ParamToggle("Pivot Voice", "No|Yes", 0);
parmPivotPop = ParamToggle("PivotPop", "No|Yes", 1);
parmBarCancel = Param("Bar Cancel", 4, 1, 20, 1);
parmFilter = ParamList("Filter", "None|KPMSL|KPWaterLevel|KPMedium", 0);
parmPlotFilter = ParamToggle("Plot Filter", "No|Yes", 0);
parmFilterColor = ParamColor("Filter Color", ColorRGB(127,255,212));
parmFilterStyle = ParamStyle("Filter Style", styleLine, maskAll);
parmBBPeriod = Param("Bollinger Band Period", 20, 2, 30, 1);
parmBBSD = Param("Bollinger Band width", 1.0, 0.5, 3.0, 0.5);
ParmPlotPPIndicators = ParamToggle("Plot Pivot Pop indicators", "No|Yes", 0);
parmBBColor = ParamColor("BBands Color", colorBlack);
parmBBStyle = ParamStyle("BBands Style", styleLine, maskAll);

ParmDebug = ParamToggle("Debug", "No|Yes", 0);

// constants
_N(PaneName = Name() + Interval(2)+ _SECTION_NAME());
_N(NewBarName = "NewBar" + PaneName);

//functions
function NewBarP()
{
PrevDT = StaticVarGet( NewBarName);
DT = LastValue(DateTime());
StaticVarSet( NewBarName,DT);
return DT != PrevDT;
}
function MRoundP(Number, Multiple )
{
if(Multiple == 0 )
{

xMultiple = 0.01; }
else
{
xMultiple = Multiple;
}
Divided = Number / xMultiple;
intDivided = int(Divided);
intDivided = intDivided + round(Divided - intDivided);
return intDivided * xMultiple;
}

//miscellaneous setups
ObjAB = CreateObject("Broker.Application");
ticker = objAB.Stocks(Name() );
if(ticker.TickSize == 0)
{
TickValue = 0.01; //set TickValue to a penney
}
else
{
TickValue = ticker.TickSize; // use Tick Size for this symbol
}
NewBarSignal = NewBarP();
// KP Indicators
KPA900 = E_TSKPA900(Close);
KPAutoStop = E_TSKPAUTOSTOP(High,Low,Close);
Ctmpl = E_TSKPCOLORTMPL(Open,High,Low,Close,Volume); //ScoreCard
KPScoreCard = 0;
KPScoreCard = KPScoreCard + IIf(tskp_colortmplcnd0 > 0, 1, -1);
KPScoreCard = KPScoreCard + IIf(tskp_colortmplcnd1 > 0, 1, -1);
KPScoreCard = KPScoreCard + IIf(tskp_colortmplcnd2 > 0, 1, -1);
KPScoreCard = KPScoreCard + IIf(tskp_colortmplcnd3 > 0, 1, -1);
KPScoreCard = KPScoreCard + IIf(tskp_colortmplcnd4 > 0, 1, -1);
KPScoreCard = KPScoreCard + IIf(tskp_colortmplcnd5 > 0, 1, -1);
KPScoreCard = KPScoreCard + IIf(tskp_colortmplcnd6 > 0, 1, -1);
KPScoreCard = KPScoreCard + IIf(tskp_colortmplcnd7 > 0, 1, -1);
KPScoreCard = KPScoreCard + IIf(tskp_colortmplcnd8 > 0, 1, -1);

if(parmDebug == 1)
{
printf("a900: %0.6f% \nAutoStop: %0.6f%\nScoreCard: %0.0f%\n", KPA900,
KPAutoStop, KPScoreCard);
}
if(parmPlotScoreCard == 1)
{
// _N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g,
Lo %g, Close %g% (%0.4f%) {{VALUES}}", O, H, L, C, SelectedValue( C - Ref(C,
-1)) ));
if( ParamToggle("Tooltip shows", "All Values|Only Prices" ) )
{
ToolTip=StrFormat("Open: %g\nHigh: %g\nLow: %g\nClose: %g
(%.2f%%)\nVolume: "+NumToStr( V, 1 ), O, H, L, C, SelectedValue( ROC( C, 1 )));
}
Color = IIf(KPScoreCard >= parmSCThreshold, colorBlue, IIf(KPScoreCard
<= -parmSCThreshold, colorRed, colorYellow) );
Plot( C, "Close", Color , styleNoTitle | styleCandle |
GetPriceStyle() );
}
//user want A900/AutoStop plotted
if(parmPlotA900AutoStop == 1)
{
Plot(KPA900, "A900", parmA900Color, parmA900Style);
Plot(KPAutoStop, "AutoStop", parmAutoStopColor, parmAutoStopStyle);
}
// find A900/AutoStop cross over/under with ScoreCard confirmation.
XOUp = (KPA900 > KPAutoStop) AND (KPScoreCard >= parmSCThreshold); // New Pivot
Low
XODn = (KPA900 < KPAutoStop) AND (KPScoreCard <= -parmSCThreshold); // New Pivot
High
if(parmDebug == 1)
{
printf(WriteIf(XOUp, "before= XOUp: True", "before= XOUp: False") +
WriteIf(XODn, " XODn: True\n", " XODn: False\n") );
}
//remove duplicate signals
XOUp = ExRem(XOUp, XODn);
XODn = ExRem(XODn, XOUp);

if(parmDebug == 1)
{
printf(WriteIf(XOUp, "after= XOUp: True", "after= XOUp: False") +
WriteIf(XODn, " XODn: True\n", " XODn: False\n") );
}
//find the current Pivot Points - PL and PH
//remember XOUp = 1 means a PL and XODn =1 means a PH
PLBars = IIf(XOUp, LowestSinceBars(XODn, L ,1), 0); //find the bar that produced
the Lowest Low
PHBars = IIf(XODn, HighestSinceBars(XOUp, H, 1),0); //find the bar that produced
the Highest High
//PLPrice = IIf(XOUp, Ref(L, -PLBars), 0);
//PHPrice = IIf(XODn, Ref(H, -PHBars),0);
PLPrice = Ref(L, -PLBars);
PHPrice = Ref(H, -PHBars);

//keep track of the previous Pivot Points


PrevPLBars = Ref(BarsSince(XOUp), -1) +1;
PrevPHBars = Ref(BarsSince(XODn), -1) +1;
PrevPLPrice = Ref(PLPrice, -prevPLBars);
PrevPHPrice = Ref(PHPrice, -PrevPHBars );
PivotsCloseEnough = TickValue * parmTickMultipler;
PLDifference = MroundP(PLPrice - PRevPLPrice, ticker.TickSize);
PHDifference = MroundP(PHPrice - PrevPHPrice, ticker.TickSize);
PPTrend = IIf(XOUp AND (PLDifference > PivotsCloseEnough) AND PrevPHPrice >
PrevPLPrice AND PRevPHPrice > PLPrice, 1,
IIf(XOUp AND (PLDifference < - PivotsCloseEnough) AND
PRevPHPrice > PrevPLPrice AND PrevPHPrice > PLPrice, -1,
IIf(XODn AND (PHDifference > PivotsCloseEnough) AND
PrevPLPrice < PrevPHprice AND PrevPLPrice < PHPrice, 1,
IIf(XODn AND (PHDifference < -PivotsCloseEnough) AND
PrevPLPrice < PrevPHPrice AND PrevPLPrice < PHPrice, -1, 0)) ));
/*
PPTrend = IIf(XOUp AND PLPrice > PRevPLPrice AND PrevPHPrice > PrevPLPrice AND
PRevPHPrice > PLPrice, 1,
IIf(XOUp AND PLPrice < PRevPLPrice AND PRevPHPrice >
PrevPLPrice AND PrevPHPrice > PLPrice, -1,
IIf(XODn AND PHPrice > PrevPHPrice AND PrevPLPrice <
PrevPHprice AND PrevPLPrice < PHPrice, 1,
IIf(XODn AND PHPrice < PrevPHPrice AND PrevPLPrice <
PrevPHPrice AND PrevPLPrice < PHPrice, -1, 0)) ));
*/
if(ParmDebug)
{
printf("Current PH Bar: %g% /Price: %g%\n", PHBars, PHPrice);
printf("Current PL Bar: %g% /Price: %g%\n", PLBars, PLPrice);
printf("Previous PH Bar: %g% /Price: %g%\n", PrevPHBars, PrevPHPrice);
printf("Previous PL Bar: %g% /Price: %g%\n", PrevPLBars, PrevPLPrice) ;
printf("PP Trend: %g%\n", PPTrend);
printf("PHPrice - PrevPHPrice: %g%\nPLPrice - PrevPLPrice: %g
%\nPivotsCloseEnough: %g%\n", PHDifference, PLDifference, PivotsCloseEnough);
}
//PLot pivots as text
dist = parmPPTextOffSet * ATR(10);
//for( i = 0; i < BarCount -1; i++)
for( i = 0; i < BarCount ; i++)
{
if(XOUp[i ] == 1 ) //cross up -plot the Pivot Low
{
PlotText("PL \n"+PLprice[i], i - PLBars[i], PLPrice[i] -
dist[i] , parmPPTextColor, IIf(PPTrend[i] == 1, parmPPTrndColorUp, IIf(PPTrend[i]
== -1, parmPPTrndColorDn, colorYellow) ));
}
if(XODn[i ] == 1 ) //cross down - plot the pivot high
{
PlotText("PH \n"+PHPrice[i], i - PHBars[i], PHPrice[i] +
dist[i], parmPPTextColor, IIf(PPTrend[i] == 1, parmPPTrndColorUp, IIf(PPTrend[i] ==
-1, parmPPTrndColorDn, colorYellow) ));
}
} //end For
// Plot A900/AutoStop cross over/under
if(parmA900AutoStopX == 1)
{
PlotShapes(IIf(Cross(KPA900, KPAutoStop), shapeUpTriangle, shapeNone),
parmA900AutoStopColorX, 0, L, -20);
PlotShapes(IIf(Cross(KPAutoStop, KPA900), shapeDownTriangle,
shapeNone), parmA900AutoStopColorX, 0, H , -20);
}
//PHLine = LineArray(BarCount - LastValue(PHBars) -3, LastValue(PHPrice), BarCount
- LastValue(PHBars) +2, LastValue(PHPrice), 0);
//Plot(PHLine, "PH", colorBlack, styleLine);
//PLLine = LineArray(BarCount - LastValue(PLBars) -3, LastValue(PLPrice), BarCount
- LastValue(PLBars) +2, LastValue(PLPrice), 0);
//Plot(PLLine, "PL", colorBlack, styleLine);
// identify M, lazy M, W and Lazy W formations
//voice
if(parmVoice ==1)
{
if(NewBarSignal)
{
if( LastValue(Ref(XODn, -1)) == 1 AND LastValue(Ref(PPTrend, -1))
== 1) Say(Interval(2) + " New pivot. Higher high.");
if( LastValue(Ref(XODn, -1)) == 1 AND LastValue(Ref(PPTrend, -1))
== -1) Say(Interval(2) + " New pivot. Lower high.");
if( LastValue(Ref(XODn, -1)) == 1 AND LastValue(Ref(PPTrend, -1))
== 0) Say(Interval(2) + " New pivot. M Top.");

if( LastValue(Ref(XOUp,-1)) ==1 AND LastValue(Ref(PPTrend, -1))


== 1) Say(Interval(2) + " New pivot. Higher low.");
if( LastValue(Ref(XOUp,-1)) ==1 AND LastValue(Ref(PPTrend, -1))
== -1) Say(Interval(2) + " New pivot. Lower low.");
if( LastValue(Ref(XOUp,-1)) ==1 AND LastValue(Ref(PPTrend, -1))
== 0) Say(Interval(2) + " New pivot. W bottom.");
}
}
//Pivot Pop code
if(parmPivotPop == 1)
{
//Kp indicators for Pivot Pop
dummy = E_TSKPFAST2(Open, High, Low, Close, Volume);
KPFast2 = IIf(tskp_fast2val1 > 0, 1, -1);
BarsSinceXOUp =BarsSince(XOUp);
BarsSinceXODn = BarsSince(XODn);
switch(parmFilter)
{
case "None":
PopFilter = True;
break;
case "KPMSL":
swVal = E_TSKPSWINGLINE(High, Low, Close);
KPMSL = tskp_swmean;
PopFilter = IIf(BarsSinceXOUp < BarsSinceXODn AND (C
> KPMSL), True, IIf(BarsSinceXODn < BarsSinceXOUp AND (C < KPMSL), True, False));
break;
case "KPWaterLevel":
KPWaterlevel =
E_TSKPWATERLEVEL(Open,High,Low,Close,Volume);
PopFilter = IIf(BarsSinceXOUp < BarsSinceXODn AND (C
> KPWaterLevel), True, IIf(BarsSinceXODn < BarsSinceXOUp AND (C < KPWaterLevel),
True, False));
break;
case "KPMedium":
dummy = E_TSKPMEDIUM(Close);
KPMediumUp = tskp_mediumup;
KPMediumDn = tskp_mediumdown;
KPMediumMA = tskp_mediumma;
KPMedium = KPMediumUp + KPMediumDn;
PopFilter = IIf(BarsSinceXOUp < BarsSinceXODn AND
(KPMedium > KPMediumMA), True, IIf(BarsSinceXODn < BarsSinceXOUp AND (KPMedium <
KPMediumMA), True, False));
break;
}
//calculations
UBB = BBandTop(C, parmBBPeriod, parmBBSD);
LBB = BBandBot(C, parmBBPeriod, parmBBSD);

if(parmDebug == 1)
{
printf("Fast2: %1.0f% \nUBB: %0.6f%\nLBB: %0.6f%\nC: %g
%\n", KPFast2, UBB, LBB, C);
printf("Bars since Last XOUp: %1.0f%\nBars since last XODn:
%1.0f%\n", BarsSinceXOUp, BarsSinceXODn );
printf("Bars since PPTrnd =1: %1.0f%\nBars since PPTrnd =
-1: %1.0f%\n", BarsSince(PPTrend ==1), BarsSince(PPTrend == -1) );
printf("ParmFilter: " + parmFilter + "\nPopFilter: %g%\n",
PopFilter);
switch(parmFilter)
{
case "None":
break;
case "KPMSL":
printf("KPMSL: %g%\n", KPMSL);
break;
case "KPWaterLevel":
printf("KPWaterlevel: %g%\n", KPWaterLevel);
break;
case "KPMedium":
printf("KPMedium: %g%\nKPMediumMA: %g%\n",
KPMedium, KPMediumMA);
break;
}
}
PPopUp = (BarsSince(PPTrend == 1) <= parmBarCancel) AND
(BarsSince(XOUp) <= parmBarCancel) AND (KPA900 >= KPAutoStop) AND(KPFast2 == 1) AND
(KPScoreCard >= 5)
AND PopFilter
AND (C > UBB) AND (C > O) ;
PPopUp = IIf( PPopUp AND Sum(PPopUP, BarsSince(XOUp)+1) == 1, True,
False ); //keep only the 1st signal
PPopDn = (BarsSince(PPTrend == -1) <= parmBarCancel) AND
(BarsSince(XODn) <= parmBarCancel) AND (KPA900 <= KPAutoStop) AND(KPFast2 == -1)
AND (KPScoreCard <= -5)
AND PopFilter
AND (C < LBB) AND (C < O) ;
PPopDn = IIf( PPopDn AND Sum(PPopDn, BarsSince(XODn) + 1) == 1, True,
False); //keep only the first signal
if(parmDebug == 1)
{
printf(WriteIf(PPopUp,"PPopUp: True", "PPopUp: False") +
WriteIf(PPopDn, " PPopDn: True\n", " PPopDn: False\n") );
printf("PPopUp sum: %1.0f% \nPPopDn sum: %1.0f%",
Sum(PPopUP, BarsSince(XOUp)) , Sum(PPopDn, BarsSince(XODn)) );
}
// Plots
PlotShapes(IIf(PPopUp, shapeHollowUpArrow, shapeNone), colorDarkBlue,
0, L, -30);
PlotShapes(IIf(PPopDn, shapeHollowDownArrow, shapeNone), colorDarkRed,
0, H, -30);

if(ParmPlotPPIndicators == 1) //plot the Pivot Pop Indicators


{
Plot(UBB, "Upper BB", parmBBColor, parmBBStyle);
Plot(LBB, "Lower BB", parmBBColor, parmBBStyle);
if(parmPlotA900AutoStop == 1)
{
Plot(KPA900, "A900", parmA900Color,
parmA900Style);
Plot(KPAutoStop, "AutoStop", parmAutoStopColor,
parmAutoStopStyle);
}
Plot( 0.5, "Fast2", IIf(tskp_fast2val1 > 0,
parmPPTrndColorUp, parmPPTrndColorDn) , styleArea | styleNoLabel | styleOwnScale ,
0, 10);
} //endif parmPlotPPIndicators
if(parmPlotFilter == 1)
{
switch(parmFilter)
{
case "None":
break;
case "KPMSL":
Plot(KPMSL, "KPMSL", parmFilterColor,
parmFilterStyle);
break;
case "KPWaterLevel":
Plot(KPWaterLevel, "KPWaterLevel",
parmFilterColor, parmFilterStyle);
break;
case "KPMedium":
// HMM how to print Medium on a price chart
break;
}
} //endif parmPlotFilter
} // end if parmPivotPop
_SECTION_END();

_SECTION_BEGIN("Fibo for all bars");

TimeFrameSet( in15Minute*2 );
DH=Ref(H,-1);
DL=Ref(L,-1);
DC=Ref(C,-1);

pd = ( DH+ DL + DC )/3;
sd1 = (2*pd)-DH;
sd2 = pd -(DH - DL);
sd3 = Sd1 - (DH-DL);
rd1 = (2*pd)-DL;
rd2 = pd +(DH -DL);
rd3 = rd1 +(DH-DL);

//Plot (pd,"Pivot",colorBlue,styleDots);
//Plot (rd1," R1 ",35,styleDots);
//Plot (rd2," R2 ",35,styleDots);
//Plot (rd3," R3 ",35,styleDots);

//Plot (sd1," S1 ",4,styleDots);


//Plot (Sd2," S2 ",4,styleDots);
//Plot (Sd3," S3 ",4,8+16);
/*
style = IIf(ParamList("Chart style", "styleCandle|
styleBar")=="styleCandle",64,128+4);
Plot (C,Date ()+" close",1,style); //ENABLE THIS TO HAVE CANDLES AS WELL
*/
TimeFrameRestore();

_SECTION_END();

Title = EncodeColor(colorWhite)+ "LINKON'S PIVOT TRADING SYSTEM" + " - " + Name()


+ " - " + EncodeColor(colorRed)+ Interval(2) + EncodeColor(colorWhite) +
" - " + Date() +" - "+"Op-"+O+" "+"Hi-"+H+" "+"Lo-"+L+" "+ "Cl-"+C+" "
+ "\n"
+ "Vol= "+ WriteVal(V) +WriteIf ( V > MA(V,26) ,EncodeColor(colorGreen)+" UP "+
(V/MA(V,26))*100 + " %", EncodeColor(colorRed)+" DOWN "+ (V/MA(V,26))*100 + " %")
+ EncodeColor(colorGreen)+ "\n R3 : "+ EncodeColor(colorWhite)+RD3
+ EncodeColor(colorGreen)+ "\n R2 : "+ EncodeColor(colorWhite)+RD2
+ EncodeColor(colorGreen)+ "\n R1 : "+ EncodeColor(colorWhite)+RD1
+ EncodeColor(colorBlue)+ "\n Pivot : "+ EncodeColor(colorWhite)+pd
+ EncodeColor(colorRed)+ "\n S1 : "+ EncodeColor(colorWhite)+SD1
+ EncodeColor(colorRed)+ "\n S2 : "+ EncodeColor(colorWhite)+SD2
+ EncodeColor(colorRed)+ "\n S3 : "+ EncodeColor(colorWhite)+SD3
;

_SECTION_BEGIN("MABIUTS");
SetChartOptions(0,chartShowArrows|chartShowDates);
//_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g,
Close %g (%.1f%%) Vol " +WriteVal( V, 1.0 ) +" {{VALUES}}", O, H, L, C,
SelectedValue( ROC( C, 1 )) ));

_SECTION_BEGIN("Trend Check");
P1 = Param("Short Period",7,0,100,1);
P2 = Param("Long Period",65,0,100,1);
L1=Param("Threshold",4,2,10,1);
U= MA(C,P1)-MA(C,P2);
R=100*U/MA(C,P2);
ap=Param("ADX Period",20,5,30,1);
MyADX=ADX(ap);
Len=Param("Length",10,1,30,1);
dp=Param("Diff Period",20,5,50,1);
Vs=ParamToggle("Select Indicator","Ravi,ADX",0);
if(Vs)
{
ta = MyADX;
}
else
{
ta=R;
}
EmaIndex=IIf(Len>0,2/(1+Len),0.20);
Diff=HHV(ta,dp)-LLV(ta,dp);
Myconst=IIf(Diff>0,(ta-LLV(ta,dp))/Diff,EMAIndex);
Newconst=IIf( MyConst > EmaIndex , EmaIndex, MyConst);
y=AMA(C,Newconst);
//Plot(y,"Trend Check",colorLightGrey);
y_color = IIf (y > Ref(y,-1),colorBlue, IIf(y < Ref(y,-1),colorRed,colorYellow));
//Plot( C, "Close", y_color , styleNoTitle | styleBar | GetPriceStyle() );
_SECTION_END();
// this section only for finding expectancy, can be skipped
SetCustomBacktestProc("");

if( Status("action") == actionPortfolio )


{
bo = GetBacktesterObject();

bo.Backtest();

st = bo.GetPerformanceStats(0);
expectancy =
st.GetValue("WinnersAvgProfit")*st.GetValue("WinnersPercent")/100 +
st.GetValue("LosersAvgLoss")*st.GetValue("LosersPercent")/100;

bo.AddCustomMetric( "Expectancy ($)", expectancy );


}

// end of expectancy calculation

PositionScore=100/C;
PositionSize = - 20;
SetBarsRequired(10000, 10000);
SetFormulaName("MABIUTS System");

//Buy=y>EMA(y,6) AND Cross (C,Peak(C,5,1));


//Sell=Cross (EMA(EMA(C,13),6),EMA(C,13));
SetTradeDelays(1, 1, 1, 1);

_SECTION_BEGIN("macd rsi");
TimeFrameSet(in5Minute);
r = Param ("rsi of ",14,3,89,1);
EMA3 = EMA(RSI(r),3);
ema27 = EMA(RSI(r),27);

diff = ema3-EMA27;
Col_rsi = IIf (EMA(diff,5) > Ref(EMA(diff,5),-1),colorBlue,colorRed);
//Plot (EMA(diff,Param("short ema",3,1,20,1)),"diff in rsi3",Col_rsi,styleThick);
//Plot (EMA(diff,Param("fast ema",5,1,50,1)),"diff in
rsi5",colorYellow,styleThick);

//Plot (0,"",colorWhite,styleThick);

Cover = Cross (EMA(diff,Param("short ema",1,1,20,1)),EMA(diff,Param("fast


ema",5,1,50,1)));
Sell = Cross (EMA(diff,Param("fast ema",5,1,50,1)), EMA(diff,Param("short
ema",1,1,20,1)));
PlotShapes (shapeUpTriangle*Cover,colorYellow);
PlotShapes (shapeDownTriangle*Sell,colorYellow);
Buy = Col_rsi == colorBlue AND diff > 1.5;
Short = Col_rsi == colorRed AND diff < -1.5;
PlotShapes (shapeHollowSmallUpTriangle*Buy,colorBlue);
PlotShapes (shapeHollowSmallDownTriangle*Short,colorRed);
TimeFrameRestore();
_SECTION_END();

_SECTION_BEGIN("Support & Resistance");


//Support and resistance levels using RSI.
//graham Kavanagh May 2003
//Load into Indicator Builder
//Sensitivity of the levels can be changed with the variables
//Can test different numbers live with the Param function ctrl-R with open pane
RSIperiod = 5; // Param("RSI p",3,14,30,1);
Percent = 5; // Param("ZIG %",8,9,15,1);
EMAperiod = 5; //Param("EMA p",4,5,10,1);
HHVperiod = 5; //Param("HHV p",3,5,10,1);
NumLine = 1; //Param("Num Lines",3,1,20,1);

Base = DEMA(RSI(RSIperiod),EMAperiod);

GraphXSpace=0.5;
//Plot(C,"",colorWhite,styleCandle);

for( i = 1; i <= numline; i++ )


{
ResBase = LastValue(Peak(Base,Percent,i));
SupBase = LastValue(Trough(Base,Percent,i));
Plot(ValueWhen( ResBase==Base, HHV(H,HHVperiod) ), "Resist Level", colorRed,
styleLine);
Plot(ValueWhen( supbase==Base, LLV(L,HHVperiod) ), "Support Level", colorGreen,
styleLine);
}
//Title = Name() + "; " + Date() + ": Support & Resistance Levels using RSI: " +
/*EncodeColor(colorGreen)+ "Support Levels are Green; "+EncodeColor(colorRed)+
"Resistance Levels are Red: "+EncodeColor(colorBlack)+*/ "Num lines
="+WriteVal(numline,1) ;
_SECTION_END();

/*
Buy = Close > KPAutoStop AND
//Y > Ref(Y,-1)
AND Col_rsi == colorBlue;

Short = Close < KPAutoStop AND


//Y < Ref(Y,-1)
AND Col_rsi == colorRed;

PlotShapes (shapeHollowSmallUpTriangle*Buy,colorBlue);
PlotShapes (shapeHollowSmallDownTriangle*Short,colorRed);
*/
ribbon_kol = IIf(Buy,colorBlue,IIf(Short,colorRed,colorYellow));
SL = ( HHV( H, 26 ) + LLV( L, 26) )/2;
TL = ( HHV( H, 9 ) + LLV( L, 9 ) )/2;
Plot (sl,"kijun",colorWhite,styleThick);
Plot (TL,"9 ichi", colorYellow,styleThick);
Color_buy = IIf (Close > sl AND Close > TL, colorBlue, IIf (Close < sl AND Close <
TL,colorRed,colorYellow));

//Plot(3, "ribbon", y_color, styleOwnScale| styleArea|styleNoLabel,-0.5,100);


Plot(6,"icchi",Color_buy,styleOwnScale| styleArea|
styleNoLabel,-0.5,100);

_SECTION_BEGIN("TSKPMoMo");
/
***********************************************************************************
***********************
This is a Price Study that displays a DOT based on the folowing:
For a long signal:
ScoreCardColor is Blue
KPMedium > Moving Average of KPMedium
KPFast2 > 0
KPFast3 > 0
KPTriggerLine > KPStopLine

For a short signal:


ScoreCardColor is Red
KPMedium < Moving Average of KPMedium
KPFast2 < 0
KPFast3 < 0
KPTriggerLine < KPStopLine

This signal will reassert itself i.e., display again if one of more of the
conditions that trigger go away
and then return to the trigger state.

Note: This indicator is calculated at the completion of a price bar. This is


different than
some indicators where the values are calculated/updated upon the arrival
of every tick.
***********************************************************************************
*************************/

blsLong = 0;

KPStopLine = E_TSKPSTOPLINE(High,Low,Close);
// tskp_upsell, tskp_triggerline, tskp_triggerlinevma
sw = E_TSKPUPSELL(Open,High,Low,Close,Volume);
KPTriggerLine = tskp_triggerline;
KPFast3Val = IIf((E_TSKPFAST3(Open,High,Low,Close,Volume)> 0),1, -1);
//tskp_fast2val1, tskp_fast2val2
dummy = E_TSKPFAST2(Open,High,Low,Close,Volume);
KPFast2Val = IIf ((tskp_fast2val1 > 0),1,-1);

Ctmpl = E_TSKPCOLORTMPL(Open,High,Low,Close,Volume);
sctotal = 0;
sctotal = sctotal + IIf(tskp_colortmplcnd0 > 0, 1, -1);
sctotal = sctotal + IIf(tskp_colortmplcnd1 > 0, 1, -1);
sctotal = sctotal + IIf(tskp_colortmplcnd2 > 0, 1, -1);
sctotal = sctotal + IIf(tskp_colortmplcnd3 > 0, 1, -1);
sctotal = sctotal + IIf(tskp_colortmplcnd4 > 0, 1, -1);
sctotal = sctotal + IIf(tskp_colortmplcnd5 > 0, 1, -1);
sctotal = sctotal + IIf(tskp_colortmplcnd6 > 0, 1, -1);
sctotal = sctotal + IIf(tskp_colortmplcnd7 > 0, 1, -1);
sctotal = sctotal + IIf(tskp_colortmplcnd8 > 0, 1, -1);

// tskp_mediumma,tskp_mediumup,tskp_mediumdown
dummy = E_TSKPMEDIUM(Close);
KPMediumUP = tskp_mediumup;
KPMediumDwn = tskp_mediumdown;
KPMediumMA = tskp_mediumma;

// -- Create 0-initialized arrays the size of barcount


aHPivs = H - H;
aLPivs = L - L;
aHiVal = H - H;
aLoVal = L - L;

for (curBar=5; curBar < BarCount-1; curBar++)


{

if( (blsLong == -1) OR (blsLong == 0))


{
if ((sctotal[CurBar] >= 5) AND (KPMediumUP[CurBar] > KPMediumMA[CurBar] )
AND (KPFast3Val[CurBar] == 1) AND
(KPFast2Val[CurBar] == 1) AND (KPTriggerLine[CurBar] >=
KPStopLine[CurBar] ))
{
blsLong = 1;
aLPivs[CurBar] = 1;
aLoVal[CurBar] = Low[CurBar];
}
}

if( (blsLong == 1) OR (blsLong == 0))


{
if ((sctotal[CurBar] <= -5) AND (KPMediumDwn[CurBar] <
KPMediumMA[CurBar] ) AND (KPFast3Val[CurBar] == -1) AND
(KPFast2Val[CurBar] == -1) AND (KPTriggerLine[CurBar] <=
KPStopLine[CurBar] ))
{
blsLong = -1;
aHPivs[Curbar] = 1;
aHiVal[Curbar] = High[Curbar];
}
}

if ((blsLong == 1) AND ((sctotal[CurBar] < 5) OR (KPMediumUP[CurBar] <


KPMediumMA[CurBar] ) OR
(KPFast2Val[CurBar] < 1) OR (KPFast3Val[CurBar] < 1) OR
(KPTriggerLine[CurBar] < KPStopLine[CurBar] )) )
{
blsLong= 0;
}

if ((blsLong == -1) AND ((sctotal[CurBar] > -5) OR (KPMediumDwn[CurBar] >


KPMediumMA[CurBar] ) OR
(KPFast2Val[CurBar] > -1) OR (KPFast3Val[CurBar] > -1) OR
(KPTriggerLine[CurBar] > KPStopLine[CurBar] )) )
{
blsLong = 0;
}
}

PlotShapes(
IIf(aHPivs == 1, shapeCircle,shapeNone), colorRed ,0, aHiVal+0.00, Offset = 30);

PlotShapes(
IIf(aLPivs == 1, shapeCircle,shapeNone), colorAqua ,0, aLoVal-0.00, Offset =
-30);

_SECTION_END();

_SECTION_BEGIN("TSKPPUSHDOTS");
Combo = E_TSKPCOMBO(Open,High,Low,Close,Volume);
NewUpDown = E_TSKPNEWUPDOWN(Open,High,Low,Close,Volume);
UpDown7 = 0.5*(High+Low) - E_TSKPSTOPLINE(High,Low,Close);

PlotShapes( IIf( ((Combo>0) AND (NewUpDown > 0) AND (UpDown7 >


0)),shapeSmallCircle,shapeNone), colorWhite,0, Low, -10);
PlotShapes( IIf( ((Combo<0) AND (NewUpDown < 0) AND (UpDown7 <
0)),shapeSmallCircle,shapeNone), colorDarkRed,0, High, 10);
_SECTION_END();

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy