// -- Modified from ProTrader v1.0
// -- http://www.wisestocktrader.com/indicators/3156-protrader-v1-0
// -- ProTrader V2.0
_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
SetBarFillColor(IIf(C>O,ParamColor("Candle Up Color",colorBrightGreen),
IIf(C<=O,ParamColor("Candle Down Color",colorRed),colorLightGrey)));//Up=Lime/Down=Red
Plot(C,"Price",IIf(C>O,ParamColor("Shadow Up Color",colorLightGrey),
IIf(C<=O,ParamColor("Shadow Down Color",colorLightGrey),colorLightGrey)),64,0,0,0,0);//Up=DarkGreen/Down=DarkRed/64=Candle/128=Bar
SetChartBkColor(ParamColor("Panel Color",colorBlack));
SetChartBkGradientFill(ParamColor("Upper Chart",colorBlack),ParamColor("Lower Chart",colorBlack));
GraphXSpace=Param("GraphXSpace",20,-10,25,1);
if(ParamToggle("Horizontal PriceLine","Show|Hide",0))
{
PriceLineColor= colorPaleBlue;
PriceLevel=C;
Daysback= 100;
FirstBar= BarCount - DaysBack;
YY= IIf(BarIndex() >= Firstbar,EndValue(PriceLevel),Null);
Plot(YY,"Current Price",PriceLineColor,styleLine|styleDashed|styleNoTitle|styleNoLabel,maskAll);
Side=1;
Dist=0;
for(i = 0; i < BarCount; i++ )
if(i+Side== BarCount) PlotText("\n " + PriceLevel[ i ], i, YY[ i ]-Dist[i], colorBlack );
}
BarTime1=LastValue(TimeNum() - Now(4));
DataError=IIf(Now(4) > TimeNum(),True,False);
TimeBase=IIf(Interval(1)>0,1,0);
_N(StrBarTime=NumToStr(BarTime1,1.0,False));
BT_Length=StrLen(StrBarTime);
_N(TimeLeft_=
WriteIf(BT_Length==1,"0:0"+StrBarTime,WriteIf(BT_Length==2,"0:"+StrBarTime,
WriteIf(BT_Length==3,StrLeft(StrBarTime,1)+":"+StrRight(StrBarTime,2),
StrLeft(StrBarTime,2)+":"+StrRight(StrBarTime,2)))));
TimeLeft=WriteIf(TimeBase==1,TimeLeft_,"N/A");
_SECTION_END();
_SECTION_BEGIN("KelvinHand");
procedure GetTriggerLines(p1, p2)
{
global TL1, TL2;
TL1 = LinearReg(C, p1);
TL2 = EMA(TL1, p2);
}
procedure GetKBands(KBandMid, ATRPeriods, K)
{
global KBandTop, KBandBot;
KBandTop=KBandMid + K * ATR( ATRPeriods );
KBandBot=KBandMid - K * ATR( ATRPeriods );
}
_SECTION_END();
_SECTION_BEGIN("Keltner Band");
Version(5.6);
//-- Created by KelvinHand on 2013-Dec-15
KC_Mode = ParamList("Band Mode", "SMA|EMA|SSMA|LWMA",2);
Periods = Param("Keltner Periods", 28, 2, 300, 1 );
P = ParamField("Price field",3);
ATRPeriods = Param("ATR Periods", 0, 0, 300, 1 );
if (ATRPeriods==0) ATRPeriods=Periods;
K = Param("K Factor", 3.50, 0, 10, 0.05 );
switch (KC_Mode)
{
case "EMA": KBandMid=EMA(P, Periods); break;
case "SSMA": KBandMid=Wilders(P, Periods); break;
case "LWMA": KBandMid=WMA(P, Periods); break;
default: KBandMid=MA(P, Periods); break;
}
GetKBands(KBandMid, ATRPeriods, K);
NOTe1=ParamStr("Style 1", "### MidBand ###");
KCMidW=Param("KCMid Width",3,0,10);
KCMidS=ParamStyle("KCMid Style",styleNoLabel|styleNoRescale);
KCMidCUp = ParamColor("KCMid Up Color", colorAqua);
KCMidCDn = ParamColor("KCMid Dn Color", ColorRGB(0,191,255));
ColM = IIf(C>KBandMid,KCMidCUp,KCMidCDn);
Plot( KBandMid, "KC.Mid" , ColM,KCMidS,Null,Null,0,0, KCMidW);
NOTe2=ParamStr("Style 2", "### OuterBand ###");
KCOutW=Param("KCOuter Width",3,0,10);
KCOutS=ParamStyle("KCOuter Style",styleNoLabel|styleNoRescale);
KCOutC = ParamColor("KCOuter Color", colorGrey40);
Plot( KBandTop, "KC.Top", KCOutC,KCMidS,Null,Null,0,0, KCOutW);
Plot( KBandBot, "KC.Bot", KCOutC,KCMidS,Null,Null,0,0, KCOutW);
_SECTION_END();
_SECTION_BEGIN("Small_TL");
p1 = Param("TL1.Periods", 20, 5, 50, 1);
p2 = Param("TL2.Periods", 5, 3, 25, 1);
GetTriggerLines(p1, p2);
_O = IIf(TL1>TL2, TL1, TL2);
_H = IIf(TL1>TL2, TL1, TL2);
_C = IIf(TL1>TL2, TL2, TL1);
_L = IIf(TL1>TL2, TL2, TL1);
Col1 = IIf(TL1 > TL2, ParamColor("Up_Color", colorLime), ParamColor("Dn_Color", ColorRGB(255,0,255)));
//PlotOHLC(_O, _H, _L, _C, _SECTION_NAME(), Col1, styleCloud|styleNoLabel, Null, Null, 0, -1);
Plot(TL1, _SECTION_NAME()+"1", Col1, styleThick|styleNoLabel);
Plot(TL2, _SECTION_NAME()+"2", Col1, styleThick|styleNoLabel);
_SECTION_END();
_SECTION_BEGIN("Large_TL");
p1 = Param("TL1.Periods", 80, 5, 100, 1);
p2 = Param("TL2.Periods", 20, 3, 100, 1);
GetTriggerLines(p1, p2);
_O = IIf(TL1>TL2, TL1, TL2);
_H = IIf(TL1>TL2, TL1, TL2);
_C = IIf(TL1>TL2, TL2, TL1);
_L = IIf(TL1>TL2, TL2, TL1);
Col1 = IIf(TL1 > TL2, ParamColor("Up_Color", colorBlue), ParamColor("Dn_Color", colorRed));
//PlotOHLC(_O, _H, _L, _C, _SECTION_NAME(), Col1, styleCloud|styleNoLabel, Null, Null, 0, -2);
Plot(TL1, _SECTION_NAME()+"1", Col1, styleThick|styleNoLabel);
Plot(TL2, _SECTION_NAME()+"2", Col1, styleThick|styleNoLabel);
_SECTION_END();