• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Tìm hiểu thêm.

Orion MA

traders

Administrator
Thành viên BQT
Tham gia ngày
29/4/17
Bài viết
224
Thích
3
Điểm
18
Website
traders.vn
#1
Code below :
---------------------------------------------------- orion MA.png

_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", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();

_SECTION_BEGIN("Price All Style");

TypeofPrice = ParamList("Type of Price","Bar Chart,Candle Stick,AmiBroker, Heiken Ashi",0);
switch(TypeofPrice)
{
case "Bar Chart":
BarColor=IIf(C>Ref(C,-1),colorBlue,colorRed);
PlotOHLC( Open, High, Low, Close, "", BarColor, styleBar);
ToolTip=StrFormat("Open: %g\nHigh: %g\nLow: %g\nClose: %g (%.1f%%)\nVolume: "+NumToStr( V, 1 ), O, H, L, C, SelectedValue( ROC( C, 1 )));
break;

case "Candle Stick":
BgColor=colorBlack;//ParamColor("BgColor", colorBlack);
SetChartBkGradientFill( BgColor,BgColor,BgColor);
upcolor=colorBlue;//ParamColor("Up color ",colorBlue);
downcolor=colorRed;//ParamColor("Down color ",colorRed);
barcolor=IIf(C>Ref(C,-1),upcolor,downcolor);
Insidecolor=IIf(C<O,barcolor,BgColor);
SetBarFillColor(Insidecolor);
PlotOHLC( Open, High, Low, Close, " " , barcolor, styleCandle | styleThick );
ToolTip=StrFormat("Open: %g\nHigh: %g\nLow: %g\nClose: %g (%.1f%%)\nVolume: "+NumToStr( V, 1 ), O, H, L, C, SelectedValue( ROC( C, 1 )));
break;

case "Heiken Ashi":
Show_color = 1;//ParamToggle("Display CandleColor", "No|Yes", 1);
r1 = 5;//Param( "ColorFast avg", 5, 2, 200, 1 );
r2 = 10;//Param( "ColorSlow avg", 10, 2, 200, 1 );
r3 = 5;//Param( "ColorSignal avg", 5, 2, 200, 1 );

Prd1=4;//Param("ATR Period",4,1,20,1);
Prd2=7;//Param("Look Back",7,1,20,1);
green = HHV(LLV(L,Prd1)+ATR(Prd1),Prd2);
red = LLV(HHV(H,Prd1)-ATR(Prd1),Prd2);

HaClose =EMA((O+H+L+C)/4,3); // Woodie
HaOpen = AMA( Ref( HaClose, -1 ), 0.5 );
HaHigh = Max( H, Max( HaClose, HaOpen ) );
HaLow = Min( L, Min( HaClose, HaOpen ) );
Temp = Max(High, HaOpen);
Temp = Min(Low,HaOpen);

m1=MACD(r1,r2);
s1=Signal(r1,r2,r3);
mycolor=IIf(m1<0 AND m1>s1, ColorRGB(230,230,0),IIf(m1>0 AND m1>s1,ColorRGB(0,0,100),IIf(m1>0 AND m1<s1,colorOrange,colorDarkRed)));

if(Show_color)
{
ColorHighliter = myColor;
SetBarFillColor( ColorHighliter );
}
m1=MACD(r1,r2);
s1=Signal(r1,r2,r3);
mycolor=IIf(m1<0 AND m1>s1, ColorRGB(230,230,0),IIf(m1>0 AND m1>s1,ColorRGB(0,0,100),IIf(m1>0 AND m1<s1,colorOrange,colorDarkRed)));
if(Show_color)
{
ColorHighliter = mycolor;
SetBarFillColor( ColorHighliter );
}
barColor=IIf(C>Green ,colorBlue,IIf(C < RED,colorRed,colorYellow));
barColor2=IIf(Close > Open, colorWhite, colorRed);
PlotOHLC( HaOpen, HaHigh, HaLow, HaClose, " " , barcolor, styleCandle | styleThick );
break;

case "AmiBroker":
_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", colorBlack , styleNoTitle+styleCandle );
ToolTip=StrFormat("Open: %g\nHigh: %g\nLow: %g\nClose: %g (%.1f%%)\nVolume: "+NumToStr( V, 1 ), O, H, L, C, SelectedValue( ROC( C, 1 )));

}
_SECTION_END();

//¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
//Orion Indicator
//with Backround color switching
//user selectable sell parameters
//10/30/2011 by_Vargasc1
//¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
_SECTION_BEGIN("Background Color");
SetChartOptions( 1, chartShowDates );
BKswitch = ParamToggle("Background Color","On,Off");

OUTcolor = ParamColor("Outer Panel Color",colorDarkTeal);
INUPcolor = ParamColor("Inner Panel Upper",colorDarkTeal);
INDNcolor = ParamColor("Inner Panel Lower",colorWhite);
TitleColor = ParamColor("Title Color ",colorBlack);

if (NOT BKswitch)
{
SetChartBkColor(OUTcolor); // color of outer border
SetChartBkGradientFill(INUPcolor,INDNcolor,TitleColor); // color of inner panel
}
_SECTION_END();
_SECTION_BEGIN("Orion");
n= Param("WMA", 0, 0, 100);
Var1=HHV(High,9)-LLV(Low,9);
Var2=HHV(High,9)-Close;
Var3=Close-LLV(Low,9);
Var4=Var2/Var1*100-70;
Var5=(Close-LLV(Low,60))/(HHV(High,60)-LLV(Low,60))*100;
Var6=(2*Close+High+Low)/4;
Var7=WMA(Var3/Var1*100,3);
Var8=LLV(Low,34);
Var9=WMA(Var7,3)-WMA(Var4,9);
VarA=IIf(Var9>100,Var9-100,0);
VarB=HHV(High,34);
AA= VarA*2;
BB= EMA((Var6-Var8)/(VarB-Var8)*100,13);
VarC=EMA(0.667*Ref(BB,-1)+0.333*BB,2);
VAR1a=(HHV(High,9)-Close)/(HHV(High,9)-LLV(Low,9))*100-70;
VAR2a=WMA(VAR1a,9)+100;
VAR3a=(Close-LLV(Low,9))/(HHV(High,9)-LLV(Low,9))*100;
VAR4a=WMA(VAR3a,3);
VAR5a=WMA(VAR4a,3)+100;
VAR6a=VAR5a-VAR2a;

S = IIf(VAR6a>n,VAR6a-n,Var6a);

barcolor=IIf(Ref(S,-1)<S, colorBrightGreen, colorRed);

Oo=IIf(Ref(S,-1)<s,Ref(s,-1),s);
Hh=Oo;
Ll=IIf(Ref(S,-1)>s,Ref(s,-1),s);
Hor=Ll;
PlotOHLC( Oo,hh,ll,Hor, "" ,barcolor, styleCandle );
_SECTION_END();

_SECTION_BEGIN("Orion MA");

a0=MA(Close,3);
a1=(H+L+C)/3;
a2=HHV(a1,15);
a3=LLV(a1,15);
a4=a2-a3;
Orion=MA((a1-a3)/a4,2)*148;
a6=HHV(a1,4*15);
a7=LLV(a1,4*15);
a8=a6-a7;
Aries=MA((a1-a7)/a8,2)*148;
aA=HHV(a1,16*15);
aB=LLV(a1,16*15);
aC=aA-aB;
Cru=MA((a1-aB)/aC,2)*148;
bot=1;
top=5;
Plot(Orion,"", colorOrange ,1);
Plot(Aries,"",colorGold,1);
Plot(Cru,"",colorLavender,1);
W= Param("Sell1_adj", 98, 70, 120);//adjust sell signal
X= Param("Sell1_A_adj", 80, 70, 120);//adjust sell signal
Y= Param("Sell2_adj", 120, 70, 140);//adjust sell signal
Buy1 = Orion>Ref(Orion,-1) AND Orion<5 AND Aries>Ref(Aries,-1) AND Aries<5 AND Cru>Ref(Cru,-1) AND Cru<5 OR Cross (Orion,Cru) AND Cru < 12;
Buy2=(Cross(Orion,bot) AND a0>Ref(a0,-1)) OR (Cross(Orion,Aries) AND Orion<Cru AND Aries<Cru );
Buy = Buy1 OR Buy2;
Sell1 = Cross(Hor,Orion) AND Hor > W OR Cross(Aries,Orion) AND Aries>X;
Sell2 = Cross(Orion,Hor) AND Hor > Y;
Sell = Sell1 OR Sell2;

PlotShapes( IIf( Buy, shapeUpArrow, shapeNone ), colorGold, layer = 0, yposition = -20 );
PlotShapes( IIf( Sell, shapeDownArrow, shapeNone ), colorWhite, layer = 0, yposition = 150 );
Title = EncodeColor( colorYellow ) + _DEFAULT_NAME() + EncodeColor( ColorRGB( 111, 208, 255 ) ) + " (" + FullName() + ") " + EncodeColor( colorGold ) + Interval( 2 ) +
" " + Date() + " " + " Open " + O + " " + "High " + H + " " + "Low " + L + " " + EncodeColor( ColorRGB( 111, 208, 255 ) ) +
"Close " + C + " ( " + WriteVal( ( C - Ref( C, -1 ) ) * 100 / Ref( C, -1 ), 1.1 ) + " %)" + EncodeColor( colorGold ) + " Volume= " + WriteVal( V, 1.0 )
+ EncodeColor( ColorRGB( 111, 208, 255 ) ) + " Orion =" + EncodeColor( colorOrange ) + WriteVal( Orion )
+ EncodeColor( ColorRGB( 111, 208, 255 ) ) + " Aries =" + EncodeColor( colorGold ) + WriteVal( Aries)
+ EncodeColor( ColorRGB( 111, 208, 255 ) ) + " Cru =" + EncodeColor( colorLavender ) + WriteVal( Cru)
+"\n" + EncodeColor( ColorRGB( 111, 208, 255 ) ) + "Hor =" + EncodeColor( colorBrightGreen ) + WriteVal( Hor);

GraphXSpace = 15 ;
_SECTION_END();
 
Top