Simple Coding Help - No Promise.

labdhi

Active Member
The ProTrader V1.0 was not efficient enough.

PHP:
// -- 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.5);
//-- 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);
Col1 = IIf(TL1 > TL2, ParamColor("Up_Color", colorBrightGreen), ParamColor("Dn_Color", ColorRGB(255,0,255)));
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);
Col1 = IIf(TL1 > TL2, ParamColor("Up_Color", colorBlue), ParamColor("Dn_Color", colorRed));
Plot(TL1, _SECTION_NAME()+"1", Col1, styleThick|styleNoLabel);
Plot(TL2, _SECTION_NAME()+"2", Col1, styleThick|styleNoLabel);
_SECTION_END();
sir looking nice on charts ;
but how to trade by this ,
can u explain plz what it is all about ;
which is best tf to look into ;
how to get max.. benifit out of it ;
thanks for u , for posting the advance version of protrader ;
 

KelvinHand

Well-Known Member
sir looking nice on charts ;
but how to trade by this ,
can u explain plz what it is all about ;
which is best tf to look into ;
how to get max.. benifit out of it ;
thanks for u , for posting the advance version of protrader ;

This is for someone know about it.
If you don't know, sorry i won't explain.
The system take long time to explain.

Here are some info:
http://www.nexgent3.com/
http://www.nexgent3.com/file uploads/Trade Setups.pdf
http://www.youtube.com/watch?v=4o9s6b1eDb8
 
Last edited:
The ProTrader V1.0 was not efficient enough.

PHP:
// -- 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.5);
//-- 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();
Kelvin

Is this a variant of the Alligator idea? I mean, Green and Blue Pairing....


P.S. After posting, I saw that you had given links to Labdhi in next post. Sorry!!!
 

KelvinHand

Well-Known Member
Kelvin

Is this a variant of the Alligator idea? I mean, Green and Blue Pairing....
No.
The system just use Keltner Channel,
Small & Large Linear Regression Line do not resemble alligator,
MACDBB momentum indicator and there is a proprietary Fib-lines confluence.
ABC pattern.

You can search info - previously called master palace.
 
Last edited:

cellclinic

Well-Known Member
The ProTrader V1.0 was not efficient enough.

Thanks for helping me bro ... but formula is giving same error in 3 coulmns ...

Plot( KBandMid, "KC.Mid" , ColM,KCMidS,Null,Null,0,0, KCMidW

Error message : Ln; 97, Col:60 ( 62 & 62 ) ; Error 16. Too nany arguments

I am using ami v5.5

Kindly check & reply ...
 

KelvinHand

Well-Known Member
The ProTrader V1.0 was not efficient enough.

Thanks for helping me bro ... but formula is giving same error in 3 coulmns ...

Plot( KBandMid, "KC.Mid" , ColM,KCMidS,Null,Null,0,0, KCMidW

Error message : Ln; 97, Col:60 ( 62 & 62 ) ; Error 16. Too nany arguments

I am using ami v5.5

Kindly check & reply ...
Your 5.5 dont support the width, so do the following replacement for the statements:

KCMidS=ParamStyle("KCMid Style",styleNoLabel|styleNoRescale|styleThick);

Plot( KBandMid, "KC.Mid" , ColM,KCMidS);


KCOutS=ParamStyle("KCOuter Style",styleNoLabel|styleNoRescale|styleThick);


Plot( KBandTop, "KC.Top", KCOutC,KCMidS);
Plot( KBandBot, "KC.Bot", KCOutC,KCMidS);



Suggest you change to Version 5.60
 
Last edited:

XRAY27

Well-Known Member
hi
happy and pratap sir,
in the below afl i want horizontal line for buytarget at entry+(entry*0.0038) and for selltarget as entry-(entry*0.0038)

_SECTION_BEGIN("Price");
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() );
_SECTION_END();

_SECTION_BEGIN("25");
MO=EMA(C,10);
ML=EMA(C,34);


Plot(MO,"",colorBlue,styleDashed);
Plot(ML,"",4,styleDashed);

Buy = Cross(MO,ML);
Sell = Cross (ML,MO);


dist = 1.5*ATR(10);

for( i = 0; i < BarCount; i++ )
{
if( Buy ) PlotText( "Buy " + H[ i ], i, H[ i ]-dist,2, colorGreen );
if( Sell ) PlotText( "SELL " + L[ i ], i, L[ i ]+dist, colorRed, colorYellow );
}

PlotShapes( Buy * shapeUpArrow + Sell * shapeDownArrow, IIf( Buy, colorYellow, colorYellow ) );
AlertIf(Cross(MO,ML), "SOUND C:\\Windows\\Media\\Ringin.wav", "BUY", 2 );
AlertIf(Cross(ML,Mo), "SOUND C:\\Windows\\Media\\Ringin.wav","SELL", 2 );



_SECTION_END();


Please look into my request :)
 
I am new to AFL, can any body help me with multi time frame? I would like trade and back test, SMA 10 and SMA 20 crossing in 15 mints while SMA 10 and SMA 20 is crossed in hourly?
 
The 10 Do’s and the Don’ts of Trading


Don’t get out of a trade when you are afraid get out when your trailing stop or stop loss is hit.

Don’t enter a trade when you are greedy for profits get in when you get an entry signal.

Don’t take a huge position size because you are greedy for profits, trade a planned position size based on risk and probability of the entry.

Don’t trade based on your personal opinions trade based on a robust methodology.

Don’t trade based on tips, trade based on your own trading plan.

Don’t have a target price let a trade go as far as it will trend.

Don’t marry your stock, do marry your risk management plan.

Don’t trade with your ego but do trade with confidence after you have done your homework.

Don’t just copy another trader’s strategy but do find a strategy that fits your own personality.

Don’t try to trade based on future predictions but do trade the current price action.
 

Similar threads