KBrain System V1.1
本帖最後由 COCO巡按 於 11-12-14 05:21 PM 編輯//KBrain System Coded by Karthikmarar. Blog. www.stocktechnician.blogspot.com email. karthikmarar@yahoo.com
//System based on the BrainTrend system in Metatrader
// The Turquiose colored Dot indicates start of a Up Trend
// The Magenta DOt indicates end of an Up move and beginning of a downmove
// The system is a Stop and reverse system
//Revision Index - V.1.1 resolves the scan issues
_SECTION_BEGIN("KBrain");
//========================Initiation========================
bts=ParamToggle("BrainTrend1 signal","No|Yes" ,1);
btst=ParamToggle("BrainTrend1 stop","No|Yes" ,1);
btsl=ParamToggle("BrainTrend1 stop line","No|Yes" ,1);
period=Param("Period",14,6,20,1);
x1=53;
x2=47;
d=2.3;
f=7;
s=1.5;
range=ATR(f);
Range1 = ATR(f)/d;
Range2 = (ATR(f)*s)/4;
range3=ATR(10);
R = ((HHV(H,period) - C) /(HHV (H,period) -LLV (L,period))) *-100;
EMA1= EMA(R,Period);
EMA2= EMA(EMA1,5);
Difference= EMA1 - EMA2;
ZeroLagEMA= EMA1 + Difference;
value2=abs(ZeroLagEMA);
function PercentR( periods )
{
return -100 * ( HHV( H, periods ) - C )/( HHV( H, periods ) - LLV( L, periods ) );
}
for( i = 1; i < Period-1; i++ )
{
tm = 1;
bstop = 1;
sstop = 1;
p = 1;
}
for( i = period+10; i < BarCount; i++ )
{
C=0;
Value2=0;
p=0;
Plot1=0;
Plot2=0;
Val1=0;
Val2=0;
temp=0;
Value3=0;
tm=0;
p1=0;
bt1=0;
bt2=0;
r=0;
bt1a=0;
bt2a=0;
istop=Val1;
stop=Val1;
bstop=0;
sstop=0;
//==================================Indicators============================
{
if (value2 < x2 AND abs(Close-Close) > range1)
p = 1 ;
else
{
if (value2 > x1 AND abs(Close-Close) > Range1)
p = 2 ;
else
p=0;
}
}
if ((value2 < x2 AND p == 1) OR (value2 < x2 AND p == 0))
{
if (abs(Close-Close) > Range1)
{
Plot1=H;
Plot2=L;
}
else
{
Plot1=Plot1;
Plot2=Plot2;
}
}
else
{
if ((value2 > x1 AND p == 2) OR (value2 > x1 AND p == 0))
{
Plot1=L;
Plot2=H;
}
else
{
Plot1=Plot1;
Plot2=Plot2;
}
}
//==================KBrain Signal ====================================
{
if (value2 < x2 AND (abs(Close-Close) > Range1))
{
if (p == 1 OR p == 0)
Value3=L-range3;
val1=Value3;
p=1;
temp=1;
}
else
{
temp=temp;
}
{
if (value2 > x1 AND (abs(Close-Close) > Range1))
{
if (p == 2 OR p == 0)
Value3=H+range3;
val2=Value3;
p=2;
temp=2;;
}
}
}
{
if (temp==1 AND Plot1>0 AND tm != 1)
tm= 1;
if (temp==2 AND Plot2>0 AND tm != 2)
tm=2;
}
//===============================stop========================================
{
if (value2 < x2 AND (abs(Close-Close) > Range1)AND p !=2)
{
value3=L-range3;
va1=Value3;
p1=2;
r=Va1;
bstop=Va1;
bt2=bt2;
}
if (value2 > x1 AND (abs(Close-Close) > Range1)AND p !=1)
{
Value3=H+range3;
va2=Value3;
p1=1;
r=Va2;
sstop=Value3;
bt1=bt1;
}
}
if (val1 == 0 AND val2 == 0 AND p == 0 )
{
bstop=bstop;
sstop=sstop;
}
if (bstop<bstop AND tm==1 AND tm==1) bstop=bstop;
if (sstop>sstop AND tm==2 AND tm==2) sstop=sstop;
}
//=============================SYSTEM======================================
Mycolor=IIf(p==1,colorLime,IIf(p==2,colorRed,colorBlue));
PlotOHLC( Open, High, Low, Close, "", Mycolor, styleCandle| styleThick );
PlotShapes( shapeCircle* (bts AND tm==1 AND Ref(tm,-1)==2),colorTurquoise, 0, bstop, 0 );
PlotShapes( shapeCircle* (bts AND tm==2 AND Ref(tm,-1)==1), colorCustom12, 0, sstop, 0 );
PlotShapes( IIf(btst AND p==1,shapeSmallCircle,Null), colorTurquoise,0,bstop,0);
Plot(IIf(btsl AND tm==1,bstop,Null),"",colorPaleBlue,1);
PlotShapes( IIf(btst AND p==2,shapeSmallCircle,Null), colorCustom12,0,sstop,0);
Plot(IIf(btsl AND tm==2,sstop,Null),"",colorLightYellow,1);
Buy=Cover=(bts AND tm==1 AND Ref(tm,-1)==2);
Sell=Short=(bts AND tm==2 AND Ref(tm,-1)==1);
SellPrice=ValueWhen(Sell,C,1);
BuyPrice=ValueWhen(Buy,C,1);
Long=Flip(Buy,Sell);
Shrt=Flip(Sell,Buy );
_SECTION_END();
//=================TITLE================================================================================================
_SECTION_BEGIN("Title");
if( Status("action") == actionIndicator )
(
Title = EncodeColor(colorWhite)+ "KBrain V 1.1. " + " - " + Name() + " - " + EncodeColor(colorRed)+ Interval(2) + EncodeColor(colorWhite) +
" - " + Date() +" - "+"\n" +EncodeColor(colorYellow) +"Op-"+O+" "+"Hi-"+H+" "+"Lo-"+L+" "+
"Cl-"+C+" "+ "Vol= "+ WriteVal(V)+"\n"+
EncodeColor(colorLime)+
WriteIf (Buy , " GO LONG / Reverse Signal at "+C+" ","")+
WriteIf (Sell , " EXIT LONG / Reverse Signal at "+C+" ","")+"\n"+EncodeColor(colorWhite)+
WriteIf(Sell , "Total Profit/Loss for the Last Trade Rs."+(C-BuyPrice)+"","")+
WriteIf(Buy , "Total Profit/Loss for the Last trade Rs."+(SellPrice-C)+"","")+
WriteIf(Long AND NOT Buy, "Trade : Long - Entry price Rs."+(BuyPrice),"")+
WriteIf(shrt AND NOT Sell, "Trade : Short - Entry price Rs."+(SellPrice),"")+"\n"+
WriteIf(Long AND NOT Buy, "Current Profit/Loss Rs."+(C-BuyPrice)+"","")+
WriteIf(shrt AND NOT Sell, "Current Profit/Loss Rs."+(SellPrice-C)+"",""));
_SECTION_END();
BuyPrice=ValueWhen(Buy,C);
SellPrice=ValueWhen(Sell,C);
Filter=(Buy OR Sell );;
AddColumn(IIf(Buy,BuyPrice,Null)," Buy ", 6.2,1,colorGreen);
AddColumn(IIf(Sell,SellPrice,Null)," sell ",6.2,1,colorOrange);
之前網路上抓過V1.0,
現在有v1.1了!{:4_163:} 你轉貼別人的東西未註明,不是你原創的還收10塊?
http://stocktechnician.blogspot.com/2009/06/kbrain-system.html
http://www.wisestocktrader.com/indicators/56-kbrain-trading-system-v1-0 不好意思,我是新手兼穷人。重新贴过:
//KBrain System Coded by Karthikmarar. Blog. www.stocktechnician.blogspot.com email. karthikmarar@yahoo.com
//System based on the BrainTrend system in Metatrader
// The Turquiose colored Dot indicates start of a Up Trend
// The Magenta DOt indicates end of an Up move and beginning of a downmove
// The system is a Stop and reverse system
//Revision Index - V.1.1 resolves the scan issues
_SECTION_BEGIN("KBrain");
//========================Initiation========================
bts=ParamToggle("BrainTrend1 signal","No|Yes" ,1);
btst=ParamToggle("BrainTrend1 stop","No|Yes" ,1);
btsl=ParamToggle("BrainTrend1 stop line","No|Yes" ,1);
period=Param("Period",14,6,20,1);
x1=53;
x2=47;
d=2.3;
f=7;
s=1.5;
range=ATR(f);
Range1 = ATR(f)/d;
Range2 = (ATR(f)*s)/4;
range3=ATR(10);
R = ((HHV(H,period) - C) /(HHV (H,period) -LLV (L,period))) *-100;
EMA1= EMA(R,Period);
EMA2= EMA(EMA1,5);
Difference= EMA1 - EMA2;
ZeroLagEMA= EMA1 + Difference;
value2=abs(ZeroLagEMA);
function PercentR( periods )
{
return -100 * ( HHV( H, periods ) - C )/( HHV( H, periods ) - LLV( L, periods ) );
}
for( i = 1; i < Period-1; i++ )
{
tm= 1;
bstop = 1;
sstop = 1;
p= 1;
}
for( i = period+10; i < BarCount; i++ )
{
C=0;
Value2=0;
p=0;
Plot1=0;
Plot2=0;
Val1=0;
Val2=0;
temp=0;
Value3=0;
tm=0;
p1=0;
bt1=0;
bt2=0;
r=0;
bt1a=0;
bt2a=0;
istop=Val1;
stop=Val1;
bstop=0;
sstop=0;
//==================================Indicators============================
{
if (value2 < x2 AND abs(Close-Close) > range1)
p = 1 ;
else
{
if (value2 > x1 AND abs(Close-Close) > Range1)
p = 2 ;
else
p=0;
}
}
if ((value2 < x2 AND p == 1) OR (value2 < x2 AND p == 0))
{
if (abs(Close-Close) > Range1)
{
Plot1=H;
Plot2=L;
}
else
{
Plot1=Plot1;
Plot2=Plot2;
}
}
else
{
if ((value2 > x1 AND p == 2) OR (value2 > x1 AND p == 0))
{
Plot1=L;
Plot2=H;
}
else
{
Plot1=Plot1;
Plot2=Plot2;
}
}
//==================KBrain Signal ====================================
{
if (value2 < x2 AND (abs(Close-Close) > Range1))
{
if (p == 1 OR p == 0)
Value3=L-range3;
val1=Value3;
p=1;
temp=1;
}
else
{
temp=temp;
}
{
if (value2 > x1 AND (abs(Close-Close) > Range1))
{
if (p == 2 OR p == 0)
Value3=H+range3;
val2=Value3;
p=2;
temp=2;;
}
}
}
{
if (temp==1 AND Plot1>0 AND tm != 1)
tm= 1;
if (temp==2 AND Plot2>0 AND tm != 2)
tm=2;
}
//===============================stop========================================
{
if (value2 < x2 AND (abs(Close-Close) > Range1)AND p !=2)
{
value3=L-range3;
va1=Value3;
p1=2;
r=Va1;
bstop=Va1;
bt2=bt2;
}
if (value2 > x1 AND (abs(Close-Close) > Range1)AND p !=1)
{
Value3=H+range3;
va2=Value3;
p1=1;
r=Va2;
sstop=Value3;
bt1=bt1;
}
}
if (val1 == 0 AND val2 == 0 AND p == 0 )
{
bstop=bstop;
sstop=sstop;
}
if (bstop<bstop AND tm==1 AND tm==1) bstop=bstop;
if (sstop>sstop AND tm==2 AND tm==2) sstop=sstop;
}
//=============================SYSTEM======================================
Mycolor=IIf(p==1,colorLime,IIf(p==2,colorRed,colorBlue));
PlotOHLC( Open, High, Low, Close, "", Mycolor, styleCandle| styleThick );
PlotShapes( shapeCircle* (bts AND tm==1 AND Ref(tm,-1)==2),colorTurquoise, 0, bstop, 0 );
PlotShapes( shapeCircle* (bts AND tm==2 AND Ref(tm,-1)==1), colorCustom12, 0, sstop, 0 );
PlotShapes( IIf(btst AND p==1,shapeSmallCircle,Null), colorTurquoise,0,bstop,0);
Plot(IIf(btsl AND tm==1,bstop,Null),"",colorPaleBlue,1);
PlotShapes( IIf(btst AND p==2,shapeSmallCircle,Null), colorCustom12,0,sstop,0);
Plot(IIf(btsl AND tm==2,sstop,Null),"",colorLightYellow,1);
Buy=Cover=(bts AND tm==1 AND Ref(tm,-1)==2);
Sell=Short=(bts AND tm==2 AND Ref(tm,-1)==1);
SellPrice=ValueWhen(Sell,C,1);
BuyPrice=ValueWhen(Buy,C,1);
Long=Flip(Buy,Sell);
Shrt=Flip(Sell,Buy );
_SECTION_END();
//=================TITLE================================================================================================
_SECTION_BEGIN("Title");
if( Status("action") == actionIndicator )
(
Title = EncodeColor(colorWhite)+ "KBrain V 1.1. " + " - " + Name() + " - " + EncodeColor(colorRed)+ Interval(2) + EncodeColor(colorWhite) +
" - " + Date() +" - "+"\n" +EncodeColor(colorYellow) +"Op-"+O+" "+"Hi-"+H+" "+"Lo-"+L+" "+
"Cl-"+C+" "+ "Vol= "+ WriteVal(V)+"\n"+
EncodeColor(colorLime)+
WriteIf (Buy , " GO LONG / Reverse Signal at "+C+" ","")+
WriteIf (Sell , " EXIT LONG / Reverse Signal at "+C+" ","")+"\n"+EncodeColor(colorWhite)+
WriteIf(Sell , "Total Profit/Loss for the Last Trade Rs."+(C-BuyPrice)+"","")+
WriteIf(Buy , "Total Profit/Loss for the Last trade Rs."+(SellPrice-C)+"","")+
WriteIf(Long AND NOT Buy, "Trade : Long - Entry price Rs."+(BuyPrice),"")+
WriteIf(shrt AND NOT Sell, "Trade : Short - Entry price Rs."+(SellPrice),"")+"\n"+
WriteIf(Long AND NOT Buy, "Current Profit/Loss Rs."+(C-BuyPrice)+"","")+
WriteIf(shrt AND NOT Sell, "Current Profit/Loss Rs."+(SellPrice-C)+"",""));
_SECTION_END();
BuyPrice=ValueWhen(Buy,C);
SellPrice=ValueWhen(Sell,C);
Filter=(Buy OR Sell );;
AddColumn(IIf(Buy,BuyPrice,Null)," Buy ", 6.2,1,colorGreen);
AddColumn(IIf(Sell,SellPrice,Null)," sell ",6.2,1,colorOrange);
你轉貼別人的東西未註明,不是你原創的還收10塊?
ironheart 發表於 11-5-10 01:07 PM http://www.coco-in.net/images/common/back.gif
好嚴厲喔 ! 小朋友會被嚇出尿尿來 !! 不好意思,我是新手兼穷人。重新贴过:
powerway 發表於 11-5-10 02:18 PM http://coco-in.net/images/common/back.gif
多多回文就有錢了啊。
{:4_153:} 這個勢什麼
{:4_186:}{:4_186:} 多多回文就有錢了啊。 說多回文就有錢,那我來賺錢{:8_545:} 哈哈, 很好笑的板大
哈哈, 很好笑的板大
頁:
[1]