إضافة رد
قديم 25-11-2015, 01:54 PM
  المشاركه #21

عضو هوامير المميز

تاريخ التسجيل: Mar 2008
المشاركات: 997
المسلفط غير متواجد حالياً  

رد: معادلات للمضارب اللحظي على الايمى بروكر


اقتباس:
المشاركة الأصلية كتبت بواسطة غنيمة مشاهدة المشاركة
اخي ممكن المعادله مره اخري من فضلك كلما اضعها في البرنامج لاتظهر معي وشكراا
http://up.arabseyes.com/do.php?filen...4883357011.rar



رد مع اقتباس
 
 

قديم 25-11-2015, 11:15 PM
  المشاركه #22

عضو هوامير المميز

تاريخ التسجيل: Apr 2012
المشاركات: 194
amm1430 غير متواجد حالياً  

رد: معادلات للمضارب اللحظي على الايمى بروكر


اقتباس:
المشاركة الأصلية كتبت بواسطة المسلفط مشاهدة المشاركة
يعطيك العافيه اخى المسلفط



رد مع اقتباس
قديم 10-01-2016, 03:36 PM
  المشاركه #23

عضو موقوف

تاريخ التسجيل: May 2005
المشاركات: 16,644
THE LORD KSA غير متواجد حالياً  

رد: معادلات للمضارب اللحظي على الايمى بروكر


بارك الله فيك


رد مع اقتباس
قديم 26-02-2016, 03:44 PM
  المشاركه #24

عضو هوامير المميز

تاريخ التسجيل: Apr 2012
المشاركات: 194
amm1430 غير متواجد حالياً  

رد: معادلات للمضارب اللحظي على الايمى بروكر


_SECTION_END();
//==============================
psh= ParamToggle("Pivot Shapes","Off|On",1);
plb= ParamToggle("Pivot Labels","Off|On",1);
snd= ParamToggle("Sound Alerts","Off|On",1);
lbk= Param("Hi Lo Lookback",350,50,5000,10);
nbz= Param("Swing Bars",5,5,150,1);
tht= Param("Hi Label Adjust",0.65,0.10,5,0.05)*ATR(5);
lbk= Min(BarCount-1,Lbk);
bc=BarCount-1;
//================
xH=H-H; xL=L-L; yH=H-H; yL=L-L; xR=H-H; xS=L-L;
xrb=0; xSb=0; yR0=0; yS0=0; xR0=0; xS0=0; xx=0;
xHH= HHVBars(H,nbz); xLL= LLVBars(L,nbz);
yHH= HHV(H,nbz); yLL= LLV(L,nbz);
viz= Status("BarVisible");
vbz= LastValue(Highest(IIf(viz,BarIndex(),0)));
_TRACE("Last visible bar: "+ vbz);
bct= (BarCount-1); = "";
if(xLL[bc]<xHH[bc]) { ="D"; } else { ="U"; }
for(i=0; i<lbk; i++) { bc=bct-i;
if(xLL[bc]<xHH[bc]) { if(=="U"){="D";
xx=bc-xLL[bc]; xL[xx]=1;
yL[xSb]=L[xx]; xS[xSb]=xx; xSb++; }
} else { if(=="D") { = "U";
xx=bc-xHH[bc]; xH[xx]=1; yH[xrb]=H[xx]; xR[xrb]=xx;xrb++; }}}
xP= 0; yP= 0; xS0= xS[0]; yS0=yL[0]; xR0= xR[0]; yR0= yH[0];
if(xS0>xR0) { xP=bc-xHH[bc]; yP= yHH[bc];
if(yR0<yP AND xP>xS0 AND xP<bc) { xH[xP]=1;
for(j=0; j<xrb; j++) { yH[xrb-j]= yH[xrb-(j+1)];
xR[xrb-j]= xR[xrb-(j+1)]; }
yH[0]= yP; xR[0]= xP; xrb++; }
} else { xP= bc-xLL[bc]; yP= yLL[bc];
if(yS0>yP AND xP>xR0 AND xP<bc) { xL[xP]=1;
for(j=0; j<xSb; j++) { yL[xSb-j]= yL[xSb-(j+1)]; xS[xSb-j]= xS[xSb-(j+1)]; }
yL[0]=yP; xS[0]=xP; xSb++; }}
ushp=shapeHollowUpArrow; dshp=shapeHollowDownArrow;
if(psh)
if(snd) {
AlertIf(xL==1,"SOUND C:\\Windows\\Media\\Windows XP Startup.wav","Audio alert",2);
AlertIf(xH==1,"SOUND C:\\Windows\\Media\\Ringin.wav","Audio alert",2); }
Buy=(xL); Sell=(xH); Cover=(xL); Short=(xH); Long=Flip(Buy,Sell); Shrt=Flip(Sell,Buy);
SellPrice=ValueWhen(Sell,H,1); BuyPrice= ValueWhen(Buy,L,1);
if(plb) {
for(i=0; i<BarCount; i++) {
if(Buy[i] )PlotText("\n\n"+ StrRight(NumToStr(L[i],6.2),10),i-1,L[i],colorWhite);
if(Sell[i])PlotText(StrRight(NumToStr(H[i],6.2),10),i-1,H[i]+tht[i],colorWhite); }
}

_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("EMA1");
P = ParamField("Price field",-1);
_SECTION_END();

PI = atan(1.00) * 4;
periods = 30;
HighHigh = HHV(H, periods);
LowLow = LLV(L, periods);
range = 25 / (HighHigh - LowLow) * LowLow;
MA1= EMA(C,200);
x1_MA = 0;
x2_MA= 1;
y1_MA= 0;
y2_MA= (Ref(MA1, -1) - MA1) / Avg * range;
c_MA= sqrt((x2_MA- x1_MA)*(x2_MA- x1_MA) + (y2_MA- y1_MA)*(y2_MA- y1_MA));
angle_MA= round(180 * acos((x2_MA - x1_MA)/c_MA) / PI);
angle_MA= IIf(y2_MA> 0, - angle_MA, angle_MA);
Col=IIf(angle_MA>3,colorWhite,IIf(angle_MA<(-3),colorRed,colorBlack));
Plot(EMA( P,200), _DEFAULT_NAME(), Col, ParamStyle("Style") );

_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
SetBarsRequired(sbrAll,sbrAll);
SetBarFillColor(IIf(C>O,ParamColor("Candle Up Color", colorBrightGreen),IIf(C<=O,ParamColor("Candle Down Color", colorRed),colorLightGrey)));
Plot(C,"Price",IIf(C>O,ParamColor("Shadow Up Color", colorBlack),IIf(C<=O,ParamColor("Shadow Down Color", colorBlack),colorLightGrey)),64,0,0,0,0);
SetChartBkColor(ParamColor("Panel Color ",colorLightGrey));
SetChartBkGradientFill(ParamColor("Upper Chart",colorLavender),ParamColor("Lower Chart",colorTan));
GraphXSpace=Param("GraphXSpace",20,-10,25,1);



_SECTION_BEGIN("Linear Regression Channel");
//CyberMan's Linear Regression Channel.

//Linear Regression Line with 2 Standard Deviation Channels Plotted Above and Below
//The original was written by Patrick Hargus, with critical hints from Marcin Gorzynski, Amibroker.com Technical Support
//Wysiwyg coded the angle in degrees part
//I modified the original Linear Regression code so that the line will change color based on the degree of the Linear Regression slope.
//I combine this with my trading system.
//When my system gives an entry signal I look at the Linear Regression Line and I will only take long positions if the Linear Regression line is green and the entry price is below the LR line.
//When my system gives an entry signal I look at the Linear Regression Line and I will only take short positions if the Linear Regression line is red and the entry price is above the LR line.
//It is usefull for filtering out lower probability trades.








_SECTION_BEGIN("MAMA");
SetBarsRequired( 10000, 10000 );
SetChartOptions(0,chartShowArrows|chartShowDates);
prc = ( High + Low ) / 2;
fastlimit = 0.5;
slowlimit = 0.05;
pi=4*atan(1);
RTD=180/pi;
DTR=pi/180;

Cyclepart=Param("Alpha",0.5,0.1,1,0.1);

Smooth[0] = Period = Detrender[0] = I1[0] = Q1[0] = 0;
phase[0]=deltaphase[0]=MAMA[0]=FAMA[0]=0;
for ( i = 6; i < BarCount; i++ )
{
Smooth[i] = ( 4 * prc[i] + 3 * prc[i-1] + 2 * prc[i-2] + prc[i-3] ) / 10;
AmpCorr[i] = 0.075 * Period[i-1] + 0.54;
Detrender[i] = ( 0.0962 * Smooth[i] + 0.5769 * Smooth[i-2] - 0.5769 * Smooth[i-4] - 0.0962 * Smooth[i-6] ) * AmpCorr[i];
Q1[i] = ( 0.0962 * Detrender[i] + 0.5769 * Detrender[i-2] - 0.5769 * Detrender[i-4] - 0.0962 * Detrender[i-6] ) * AmpCorr[i];
I1[i] = Detrender[i-3];
if (I1[i] != 0) phase[i] = DTR*360/atan(q1[i]/I1[i]);
deltaphase[i]=phase[i-1]-phase[i];
if (deltaphase[i] <1) deltaphase[i]=1;
alpha[i]=fastlimit[i]/deltaphase[i];
if (alpha[i] < slowlimit[i]) alpha[i]=slowlimit[i];
MAMA[i]=alpha[i] * prc [i] +(1-alpha[i])*MAMA[i-1];
FAMA[i]=Cyclepart*alpha[i] * prc [i] +(1-Cyclepart*alpha[i])*FAMA[i-1];
}

_SECTION_END();

_SECTION_BEGIN("SYSTEM");
BuySetupValue=ValueWhen(Cross(MAMA,FAMA),H,1);
SellsetupValue=ValueWhen(Cross(FAMA,MAMA),L,1);
Buysetup =Cross(MAMA,FAMA) ;
Sellsetup = Cross(FAMA,MAMA);
Longa = Flip(Buysetup,Sellsetup);
shrta = Flip(Sellsetup,Buysetup);
Buy=Longa AND Cross(C,BuySetupValue);
Sell=shrta AND Cross(SellsetupValue,C);
Buy = ExRem(Buy,Sell);
Sell = ExRem(Sell,Buy);
t1= Flip(Buy,Sell);
t2= Flip(Sell,Buy);
BPrice=ValueWhen(t1 AND Ref(t1,-1)==0,C,1);
SPrice=ValueWhen(t2 AND Ref(t2,-1)==0,C,1);
GraphXSpace = 5;
dist = 1.5*ATR(20);
for( i = 0; i < BarCount; i++ )
{
if( Buy[i] ) PlotText( "" + C[ i ], i, L[ i ]-dist[i], colorBlack );
if( Sell[i] ) PlotText( "" + C[ i ], i, H[ i ]+dist[i], colorBlack );
}
_SECTION_END();
//=================TITLE======================================================== ========================================
_SECTION_BEGIN("Title");
if( Status("action") == actionIndicator )
(
Title = EncodeColor(colorWhite)+ "MAMA Poistional System" + " - " + 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-BPrice)+"","")+
WriteIf(Buy , "Total Profit/Loss for the Last trade Rs."+(SPrice-C)+"","")+
WriteIf(Longa AND NOT Buy, "Trade : Long - Entry price Rs."+(BPrice),"")+
WriteIf(shrta AND NOT Sell, "Trade : Short - Entry price Rs."+(SPrice),"")+"\n"+
WriteIf(Longa AND NOT Buy, "Current Profit/Loss Rs."+(C-BPrice)+"","")+
WriteIf(shrta AND NOT Sell, "Current Profit/Loss Rs."+(SPrice-C)+"",""));
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-40);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-50);
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-45);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorRed, 0, H, Offset=40);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorOrange, 0,H, Offset=50);
PlotShapes(IIf(Sell, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-45);
_SECTION_END();
WriteVal(BuyPrice);
WriteVal(Longa);
WriteVal(t1);
WriteVal(SellPrice);
WriteVal(shrta);
_SECTION_END();
//=========================== Back ground Text ===================
_SECTION_BEGIN("Background text");
GfxSetOverlayMode(1);
GfxSelectFont("Tahoma", Status("pxheight")/23 );
GfxSetTextAlign( 0 );// center alignment
//GfxSetTextColor( ColorRGB( 60, 45, 80 ) );
GfxSetTextColor( ColorHSB( 42, 42, 42 ) );
//GfxSetTextColor( ColorHSB( 5, 5,242) );
GfxSetBkMode(0); // transparent
GfxTextOut( Name(), Status("pxwidth")/2, Status("pxheight")/12 );
GfxSelectFont("Tahoma", Status("pxheight")/12 );
GfxTextOut( "", Status("pxwidth")/2, Status("pxheight")/3 );
GfxSelectFont("Tahoma", Status("pxheight")/20 );
GfxTextOut( "", Status("pxwidth")/2, Status("pxheight")/2 );
GfxSelectFont("Tahoma", Status("pxheight")/40 );
GfxTextOut( "", Status("pxwidth")/7, Status("pxheight")/6);

_SECTION_END();

_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
SetBarsRequired(sbrAll,sbrAll);
SetBarFillColor(IIf(C>O,ParamColor("Candle Up Color", colorBrightGreen),IIf(C<=O,ParamColor("Candle Down Color", colorRed),colorLightGrey)));
Plot(C,"Price",IIf(C>O,ParamColor("Shadow Up Color", colorBlack),IIf(C<=O,ParamColor("Shadow Down Color", colorBlack),colorLightGrey)),64,0,0,0,0);
SetChartBkColor(ParamColor("Panel Color ",colorLightGrey));
SetChartBkGradientFill(ParamColor("Upper Chart",colorLavender),ParamColor("Lower Chart",colorTan));
GraphXSpace=Param("GraphXSpace",20,-10,25,1);




TimeFrameSet(inDaily);
DayHigh = LastValue(H);
DayLow = LastValue(L);
TimeFrameRestore();

Title = Date() + ", Op=" + Open + ", Hi=" + High + ", Lo=" + Low + ", LTP=" + Close + ", Change= " + SelectedValue( ROC( C, 1 ) ) + "%" + "\n Today`s High=" + DayHigh + ", Today`s Low=" + DayLow + " © " ;


prev=AMA2(C,1,0);
d=IIf(C>Ref(Max(Max(H,Ref(H,-20)),Max(Ref(H,-10),Ref(H,-15))),-1),Min(Min(L,Ref(L,-20)),Min(Ref(L,-10),Ref(L,-15))),
IIf(C<Ref(Min(Min(L,Ref(L,-20)),Min(Ref(L,-10),Ref(L,-15))),-1),Max(Max(H,Ref(H,-20)),Max(Ref(H,-10),Ref(H,-15))),PREV));
a=Cross(Close,d);
b=Cross(d,Close);
state=IIf(BarsSince(a)<BarsSince(b),1,0);
s=state>Ref(state,-1);
ss=state<Ref(state,-1);
sss=state==Ref(state,-1);
col=IIf(state == 1 ,51,IIf(state ==0,4,1));
Plot(C,"",Col,64);
Buy = s;
Sell = ss;
shape = Buy * shapeUpArrow + Sell * shapeDownArrow;
//WriteIf(s,"EXIT all Short positions\nif trading long positions, enter long Now-\nOR at the market price on tomorrow's Open with stop="+EncodeColor(4)+WriteVal(L+.75*ATR(5),1.4)+" ,","");
//WriteIf(ss,"exit all long positions today with a Market On Close (MOC) order\nOR at the market price on tomorrow's Open with stop="+EncodeColor(4)+WriteVal(Ref(H+.75*ATR(5), -1),1.4)+",","");
//WriteIf( sss ,"No trading signals today.","") ;


dist = 2*ATR(10);
dist1 = 5*ATR(10);
for( i = 0; i < BarCount; i++ )
{
if( Buy[i] )
{}
if( Sell[i] )
{}
}


Filter = s OR sss OR sss ;
AddColumn(C,"close",1.2);
AddColumn( IIf( s, 66,1 ), "buy", formatChar, 1, bkcolor =IIf (s,colorYellow, colorPink ));
AddColumn( IIf( Ss, 83,1 ), "sell", formatChar, 1, bkcolor =IIf (Ss,colorPink, colorWhite ));
AddColumn( IIf( sss, 87,1 ), "wait", formatChar, 1, bkcolor =IIf (sss,colorYellow, colorRed ));




_SECTION_BEGIN("BACK COLR");

GfxSetOverlayMode(1);

GfxSetOverlayMode(1);
GfxSelectFont("Tahoma", Status("pxheight")/200 ); /* Up down name*/
GfxSetTextAlign( 6 );// center alignment
GfxSetTextColor( ParamColor("Text Color", ColorHSB( 42, 42, 42 ) ));
GfxSetBkMode(0); // transparent
GfxTextOut( Name(), Status("pxwidth")/2, Status("pxheight")/7);
GfxSelectFont("Tahoma", Status("pxheight")/300 );
GfxTextOut( IndustryID(1), Status("pxwidth")/2, Status("pxheight")/5 ); /* Up Down Sector*/

GfxSelectFont("Tahoma", Status("pxheight")/40 );
GfxTextOut( " ", Status("pxwidth")/2, Status("pxheight")/4);
GfxSelectFont("Tahoma", Status("pxheight")/20 );
GfxTextOut( " ", Status("pxwidth")/2, Status("pxheight")/15 );

_SECTION_BEGIN("Trade");
SetChartBkColor(ParamColor("Outer panel color ",colorLightYellow));
SetChartBkColor(ParamColor("BackGround Color", colorLavender));
pShowtradeLines = ParamToggle("Show Trade Lines", "No|Yes", 1);
pShowMarkers = ParamToggle("Show Markers", "No|Yes", 1);
synch=ParamToggle("Synchronize buy/short with foreign index", "No|Yes", 1);
Volmin=Param("Volume minimum",5000,0,10000000,50);
Volmax=Param("Volume maximum",1000000,0,10000000,50);
priceRL=Param("Price Range Min",150,1,20000,1);
priceRH=Param("Price Range Max",3000,1,20000,1);
PercChangemin=Param("Percentage Change Min set", -25, -100, 100, 0.1);
PercChangemax=Param("Percentage Change Max set", 25, -100, 100, 0.1);
PerctakeProfit=Param("Take Profit Percent Set",0.5,0.3,30,0.1);
PercStoploss=Param("StopLoss Percent Set",1,0.2,5,0.1);

PlotOHLC(Open,High,Low,Close,"",colorWhite,styleCandle);
Bars = 0;
xpdh = 90;

{
Plot_Range = (TimeNum() >= 85500 AND TimeNum()<= 153500) AND (DateNum()==LastValue(DateNum()));
FH_Range = (TimeNum() >= 085500 AND TimeNum()<= 093000) AND (DateNum()==LastValue(DateNum()));

FH_Prices = High * FH_Range;
FH_Marker = BarsSince(FH_Range>0);

Num_Bars = 36000 / Interval(1);

TimeFrameSet(inDaily);
TOP_ = Open;
PDH_ = Ref(High,-1);
PDL_ = Ref(Low,-1);
PDO_ = Ref(Open,-1);
PDC_ = Ref(Close,-1);
PDM_ = (PDH_+PDL_)/2;
TimeFrameRestore();

isAll = True;
isRth = TimeNum() >= 085400 AND TimeNum() <= 093000;
isdRth = TimeNum() >= 085400 AND TimeNum() <= 160000;

aRthL = IIf(isRth, L, 1000000);
aRthH = IIf(isdRth, H, Null);
aRthLd = IIf(isdRth, L, 1000000);

TOP = TimeFrameExpand(TOP_,inDaily,expandFirst);
PDH = TimeFrameExpand(PDH_,inDaily,expandFirst);
PDL = TimeFrameExpand(PDL_,inDaily,expandFirst);
PDO = TimeFrameExpand(PDO_,inDaily,expandFirst);
PDC = TimeFrameExpand(PDC_,inDaily,expandFirst);
PDM = TimeFrameExpand(PDM_,inDaily,expandFirst);
FHH = Ref(HHV(High*FH_Range,Num_Bars),-FH_Marker);
FHL = TimeFrameCompress( aRthL, inDaily, compressLow );
FHL = TimeFrameExpand( FHL, inDaily, expandFirst );
DayH = TimeFrameCompress( aRthH, inDaily, compressHigh );
DayH = TimeFrameExpand( DayH, inDaily, expandFirst );
DayL = TimeFrameCompress( aRthLd, inDaily, compressLow );
DayL = TimeFrameExpand( DayL, inDaily, expandFirst );


FC1=((PDH-PDL)*0.433);
FC2=((PDH-PDL)*0.7666);
FC3=((PDH-PDL)*1.355);
FC4=(FHH-FHL);

A=IIf((FC4<=FC1+PDH*0.005),FC1,0);
B=IIf((FC4<=FC2+PDH*0.005 AND FC4>FC1+PDH*0.005),FC2,0);
Cl=IIf((FC4<=FC3 AND FC4>FC2+PDH*0.005),FC3,0);
AF=(A+B+Cl);
_SECTION_BEGIN("Trade");
SetChartBkColor(ParamColor("Outer panel color ",colorLightYellow));
SetChartBkColor(ParamColor("BackGround Color", colorBlack));
pShowtradeLines = ParamToggle("Show Trade Lines", "No|Yes", 1);
pShowMarkers = ParamToggle("Show Markers", "No|Yes", 1);
synch=ParamToggle("Synchronize buy/short with foreign index", "No|Yes", 1);
Volmin=Param("Volume minimum",5000,0,10000000,50);
Volmax=Param("Volume maximum",1000000,0,10000000,50);
priceRL=Param("Price Range Min",150,1,20000,1);
priceRH=Param("Price Range Max",3000,1,20000,1);
PercChangemin=Param("Percentage Change Min set", -25, -100, 100, 0.1);
PercChangemax=Param("Percentage Change Max set", 25, -100, 100, 0.1);
PerctakeProfit=Param("Take Profit Percent Set",0.5,0.3,30,0.1);
PercStoploss=Param("StopLoss Percent Set",1,0.2,5,0.1);

PlotOHLC(Open,High,Low,Close,"",colorWhite,styleCandle);
Bars = 0;
xpdh = 90;

{
Plot_Range = (TimeNum() >= 85500 AND TimeNum()<= 153500) AND (DateNum()==LastValue(DateNum()));
FH_Range = (TimeNum() >= 085500 AND TimeNum()<= 093000) AND (DateNum()==LastValue(DateNum()));

FH_Prices = High * FH_Range;
FH_Marker = BarsSince(FH_Range>0);

Num_Bars = 36000 / Interval(1);

TimeFrameSet(inDaily);
TOP_ = Open;
PDH_ = Ref(High,-1);
PDL_ = Ref(Low,-1);
PDO_ = Ref(Open,-1);
PDC_ = Ref(Close,-1);
PDM_ = (PDH_+PDL_)/2;
TimeFrameRestore();

isAll = True;
isRth = TimeNum() >= 085400 AND TimeNum() <= 093000;
isdRth = TimeNum() >= 085400 AND TimeNum() <= 160000;

aRthL = IIf(isRth, L, 1000000);
aRthH = IIf(isdRth, H, Null);
aRthLd = IIf(isdRth, L, 1000000);

TOP = TimeFrameExpand(TOP_,inDaily,expandFirst);
PDH = TimeFrameExpand(PDH_,inDaily,expandFirst);
PDL = TimeFrameExpand(PDL_,inDaily,expandFirst);
PDO = TimeFrameExpand(PDO_,inDaily,expandFirst);
PDC = TimeFrameExpand(PDC_,inDaily,expandFirst);
PDM = TimeFrameExpand(PDM_,inDaily,expandFirst);
FHH = Ref(HHV(High*FH_Range,Num_Bars),-FH_Marker);
FHL = TimeFrameCompress( aRthL, inDaily, compressLow );
FHL = TimeFrameExpand( FHL, inDaily, expandFirst );
DayH = TimeFrameCompress( aRthH, inDaily, compressHigh );
DayH = TimeFrameExpand( DayH, inDaily, expandFirst );
DayL = TimeFrameCompress( aRthLd, inDaily, compressLow );
DayL = TimeFrameExpand( DayL, inDaily, expandFirst );


FC1=((PDH-PDL)*0.433);
FC2=((PDH-PDL)*0.7666);
FC3=((PDH-PDL)*1.355);
FC4=(FHH-FHL);

A=IIf((FC4<=FC1+PDH*0.005),FC1,0);
B=IIf((FC4<=FC2+PDH*0.005 AND FC4>FC1+PDH*0.005),FC2,0);
Cl=IIf((FC4<=FC3 AND FC4>FC2+PDH*0.005),FC3,0);
AF=(A+B+Cl);

//foreign
_SECTION_BEGIN ("foreign Index bar graph");
Vr=ParamList("Index",List = "^NSEI,^NSEBANK,^CNXIT,^NSMIDCP,RELIANCE.NS,SB IN.N S",0);
SetForeign(Vr);
HaC =(O+H+L+C)/4;
HaO = AMA( Ref( HaC, -1 ), 0.5 );
HaH = Max( H, Max( HaC, HaO) );
HaL = Min( L, Min( HaC, HaO) );
BG3=HHV(LLV(HaL,4)+ATR(4),8);
BR3=LLV(HHV(HaH ,4)-ATR(4),8);
co = IIf(Hac>BG3 ,colorTan,IIf(Hac < BR3,colorTan,colorTan));
Plot(4, "", Co,styleArea+styleOwnScale | styleNoLabel, -1, 100);
RestorePriceArrays();
_SECTION_END();

BuyPrice=(DayL+AF);
BuyTP1=(BuyPrice+(BuyPrice*(PerctakeProfit/100)));
BuyTP2=(C>=BuyTP1);
SellPrice=(DayH-AF);
SellTP1=(SellPrice-(SellPrice*(PerctakeProfit/100)));
SellTP2=(C<=SellTP1);
percchange=(((C-TOP)/TOP)*100);
Vol=(V>=Volmin AND V<=Volmax);
Percentage=(percchange>=PercChangemin AND percchange<=PercChangemax);
prc=(C>=priceRL AND C<=priceRH);
BuyStop1=(BuyPrice-(BuyPrice*(PercStoploss/100)));
BuyStop2=IIf((BuyStop1<=SellPrice) AND SellPrice<=BuyPrice,SellPrice,BuyStop1);
SellStop1=(SellPrice+(SellPrice*(PercStoploss/100)));
SellStop2=IIf((SellStop1>=BuyPrice) AND SellPrice<=BuyPrice, BuyPrice,SellStop1);

BuyStop=IIf((Buy AND NOT BuyTP2),BuyStop2,Null);
BuyTP=IIf(Buy AND NOT BuyStop,BuyTP2,Null);

Bars = BarsSince(TimeNum() >= 85400 AND TimeNum() < 092900);
x0 = BarCount-LastValue(Bars);
x1 = BarCount-1;
TOP_Line = LineArray(x0,LastValue(TOP),x1,LastValue(TOP),0);
PDH_Line = LineArray(x0,LastValue(PDH),x1,LastValue(PDH),0);
PDL_Line = LineArray(x0,LastValue(PDL),x1,LastValue(PDL),0);
PDC_Line = LineArray(x0,LastValue(PDC),x1,LastValue(PDC),0);
PDM_Line = LineArray(x0,LastValue(PDM),x1,LastValue(PDM),0);
FHH_Line = LineArray(x0,LastValue(FHH),x1,LastValue(FHH),0);
FHL_Line = LineArray(x0,LastValue(FHL),x1,LastValue(FHL),0);
BuyPriceline=LineArray(x0,LastValue(BuyPrice),x1,LastValue(BuyPrice),2);
BuyStopline=LineArray(x0,LastValue(BuyStop2),x1,LastValue(BuyStop2),0);
BuyTPline=LineArray(x0,LastValue(BuyTP1),x1,LastValue(BuyTP1),0);
SellPriceline=LineArray(x0,LastValue(SellPrice),x1 ,LastValue(SellPrice),2);
SellStopline=LineArray(x0,LastValue(SellStop2),x1, LastValue(SellStop2),0);
SellTPline=LineArray(x0,LastValue(SellTP1),x1,LastValue(SellTP1),0);
DayHline=LineArray(x0,LastValue(DayH),x1,LastValue (DayH),0);
DayLline=LineArray(x0,LastValue(DayL),x1,LastValue (DayL),0);


style = styleLine | styleNoRescale|styleLine;
Plot(BuyPriceline, "BuyPriceline",colorOrange , styleDashed|styleNoRescale|styleThick);


Plot(SellPriceline, "SellPriceline",colorOrange
,styleDashed|styleNoRescale|styleThick);


PlotShapes(IIf(pShowMarkers AND Buy, shapeHollowUpArrow, Null), colorDarkGreen, 0,L,Offset=-30);

if( Status("action") == actionIndicator )
(
Title = EncodeColor(colorBlack)+ "Trading System" + " - " + Name() + " - " + EncodeColor(colorBlack)+ Interval(2) + EncodeColor(colorBlack) +
" - " + Date() +" - "+ EncodeColor(colorBlack) + "-Open="+WriteVal(O,1) + EncodeColor(colorBlack) + "- High= "+ WriteVal(H,1)+ EncodeColor(colorBlack) + "- Close= "+ WriteVal(C,1)+ EncodeColor(colorBlack) + "- Vol= "+ WriteVal(V,1)+ WriteIf(Percchange, " % Change = "+(Percchange)+" ","")+("\n")+
" Previous DayHigh="+WriteVal(PDH,1)+", Previous DayLow="+WriteVal(PDL,1)+", Today High="+WriteVal(DayH,1)+", Todays Low="+WriteVal(DayL,1)+
Comm2=("\n "+Vr+" Phase: ")+
WriteIf(Hac>BG3,EncodeColor(colorBrightGreen)+"+Up ",
WriteIf(Hac<BR3,EncodeColor(colorRed)+"-Down",EncodeColor(colorLightYellow)+"< Flat >")));

GfxSetOverlayMode( mode = 0 );
GfxSelectPen( colorLightBlue, 3 );
GfxSelectSolidBrush( colorLightYellow );
GfxRoundRect( 20, 55, 180, 175, 15, 15 );
GfxSetBkMode(1);
GfxSelectFont( "Arial", 10, 700, False );
GfxSetTextColor( colorBrown );
GfxSetTextAlign(0);
GfxTextOut( WriteIf(BuyPrice, "Buy Above: "+(BuyPrice),""), 30, 75);
GfxTextOut( WriteIf(SellPrice, "Sell Below: "+(SellPrice),""), 30, 120);
GfxTextOut( WriteIf(Buystop2, "TRP level: "+(Buystop2),""), 30, 60);
AddColumn(V,"Volume",1.0);
AddColumn(Percchange,"Change %",1.2);
AddColumn(BuyPrice,"Buy at",1.2);
AddColumn(BuyStop,"Buy Stop at",1.2);
AddColumn(BuyTP1,"Buy Profit at",1.2);
AddColumn(SellPrice,"Short at",1.2);
AddColumn(SellTP1,"Short profit at",1.2);

}

_SECTION_END();


//ADDED PIVOTS LINES LATER

}

_SECTION_END();



//SetChartBkGradientFill( ParamColor("BgTop", ColorRGB( 172,172,172 )),

//ParamColor("BgBottom", ColorRGB( 172,172,172 )),ParamColor("title",ColorRGB( 172,172,172 )));


GraphXSpace = 16;

SetChartBkColor(colorTan);
SetChartOptions(0,chartShowArrows|chartShowDates);


A = DEMA (H,180);
B = EMA (H,100);
G = DEMA (L,180);
I = EMA(L,100);
D = Min (G,I);
E = Max (A,B);
/* Buy or Sell Condition */
Buy =Cover= Cross(Close,E);
Sell = Short=Cross(D,Close);
Buy = ExRem(Buy,Sell);
Sell = ExRem(Sell,Buy);
SellPrice=ValueWhen(Sell,C,1);
BuyPrice=ValueWhen(Buy,C,1);

Filter = Buy OR Sell;
/* Exploration Parameters */
AddTextColumn( FullName(), "Company Name" );
AddColumn( Buy, "Buy", 1 );
AddColumn( Sell, "Sell", 1 );
AddColumn( C, "Close", 1.3 );
AddColumn( H, "High", 1.3 );

Title = EncodeColor(colorWhite)+ " © (Equity) Market Trading System" + " - " + Name() + " - " + EncodeColor(colorRed)+ Interval(2) + EncodeColor(colorWhite) +
" - " + Date() +" - "+"\n" +EncodeColor(colorRed) +"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);

_SECTION_END();


Buy = ExRem(Buy,Sell);
Sell = ExRem(Sell,Buy);


//SetChartBkColor(colorBlack);
//GraphXSpace = 10;

_SECTION_BEGIN("imp 2500 plane for overlay only");
prev=AMA2(C,1,0);
d=IIf(C>Ref(Max(Max(H,Ref(H,-20)),Max(Ref(H,-10),Ref(H,-15))),-1),Min(Min(L,Ref(L,-20)),Min(Ref(L,-10),Ref(L,-15))),
IIf(C<Ref(Min(Min(L,Ref(L,-20)),Min(Ref(L,-10),Ref(L,-15))),-1),Max(Max(H,Ref(H,-20)),Max(Ref(H,-10),Ref(H,-15))),PREV));
a=Cross(Close,d);
b=Cross(d,Close);
state=IIf(BarsSince(a)<BarsSince(b),1,0);
s=state>Ref(state,-1);
ss=state<Ref(state,-1);
sss=state==Ref(state,-1);
col=IIf(state == 1 ,5,IIf(state ==0,4,1));
Plot(C,"",Col,64);


//d = Close > Ref( ChandelierHL(ATR(3),20), -1);
//e =Close < Ref( ChandelierHL(ATR(3),20), -1);
//f = Close < Ref( ChandelierHL(ATR(3),20), -1);
//g = Close > Ref( ChandelierHL(ATR(3),20), -1);

DayH = SelectedValue(TimeFrameGetPrice("H", inDaily));// yesterdays high
DayL = SelectedValue(TimeFrameGetPrice("L", inDaily));//low
DayH1 = SelectedValue(TimeFrameGetPrice("H", inDaily, -1));// yesterdays high
DayL1 = SelectedValue(TimeFrameGetPrice("L", inDaily, -1));//low
DayH2 = SelectedValue(TimeFrameGetPrice("H", inDaily, -2));// yesterdays high
DayL2 = SelectedValue(TimeFrameGetPrice("L", inDaily, -2));//low
DayH3 = SelectedValue(TimeFrameGetPrice("H", inDaily, -3));// yesterdays high
DayL3 = SelectedValue(TimeFrameGetPrice("L", inDaily, -3));//low
DayH4 = SelectedValue(TimeFrameGetPrice("H", inDaily, -4));// yesterdays high
DayL4 = SelectedValue(TimeFrameGetPrice("L", inDaily, -4));//low

Range = ((DayH+DayH1+DayH2+DayH3+DayH4)/5 - (DayL+DayL1+DayL2+DayL3+DayL4)/5);
sr3= (Range *0.702)+DayL;
sr4= DayH-(Range *0.655);

style = styleLine | styleNoRescale|styleLine;
Plot(sr3, "SR3",colorBlue , styleDashed|styleNoRescale|styleThick);
Plot(sr4, "SR4",colorGreen ,styleDashed|styleNoRescale|styleThick);

Bars_so_far_today = 1 + BarsSince( Day() != Ref(Day(), -1));
TT= RSIa(C,60);
StartBar = ValueWhen(TimeNum() == 090000, BarIndex());
TodayVolume = Sum(TT,Bars_so_far_today);
IIf (BarIndex() >= StartBar, VWAP = Sum (C * TT, Bars_so_far_today ) / TodayVolume,0);





GraphXSpace = 16;




A = DEMA (H,180);
B = EMA (H,100);
G = DEMA (L,180);
I = EMA(L,100);
D = Min (G,I);
E = Max (A,B);
/* Buy or Sell Condition */
Buy =Cover= Cross(Close,E);
Sell = Short=Cross(D,Close);
Buy = ExRem(Buy,Sell);
Sell = ExRem(Sell,Buy);
SellPrice=ValueWhen(Sell,C,1);
BuyPrice=ValueWhen(Buy,C,1);

Filter = Buy OR Sell;
/* Exploration Parameters */
AddTextColumn( FullName(), "Company Name" );
AddColumn( Buy, "Buy", 1 );
AddColumn( Sell, "Sell", 1 );
AddColumn( C, "Close", 1.3 );
AddColumn( H, "High", 1.3 );

Title = EncodeColor(colorWhite)+ " " + " - " + Name() + " - " + EncodeColor(colorRed)+ Interval(2) + EncodeColor(colorWhite) +
" - " + Date() +" - "+"\n" +EncodeColor(colorRed) +"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(colorPink);

_SECTION_END();


Buy = ExRem(Buy,Sell);
Sell = ExRem(Sell,Buy);




//GraphXSpace = 10;
_SECTION_END();


Plot(EMA(C,21),"",colorYellow,4);
Plot(EMA(C,40),"",colorBlue,4);
Plot(EMA(C,50),"",colorWhite,4);

Buy=Cross(EMA(C,5),EMA(C,40));
Sell=Cross(EMA(C,40),EMA(C,5));
PlotShapes(IIf(Buy,shapeSmallUpTriangle,shapeNone),colorWhite,0,L,-12);
PlotShapes(IIf(Sell,shapeSmallDownTriangle, shapeNone),colorWhite,0,H,-12);



_SECTION_BEGIN("Advanced Trend Lines");
function GetXSupport(Lo, Percentage, Back)
{
return ((BarCount - 1) - LastValue(TroughBars(Lo, Percentage,Back)));
}
function GetYSupport(Lo, Percentage, Back)
{
return (LastValue(Trough(Lo, Percentage, back)));
}

function GetXResistance(Hi, Percentage, Back)
{
return ((BarCount - 1) -LastValue(PeakBars(Hi, Percentage, Back)));
}
function GetYResistance(Hi, Percentage, Back)
{
return (LastValue(Peak(Hi, Percentage, Back)));
}
function TD_Supply(P)
{
return ( P > Ref(P, 1) AND P > Ref(P, -1) AND P > Ref(C, -2));
}
function TD_Demand(P)
{
return ( P < Ref(P, 1) AND P < Ref(P, -1) AND P < Ref(C, -2));
}
////////////////////////////////////////////////////////////////////////
//Parameters
Percentage = Param("Percentage", 1.5, 0.01, 100. ,0.01);
DrawAllLines = ParamToggle("Draw All Lines?", "No|Yes");
Lines = Param("Lines?", 1, 1, BarCount-2);
DrawR = ParamList("Resistance Points", "Off|High to High|High to Low", 1);
DrawS = ParamList("Support Points", "Off|Low to Low|Low to High", 1);
ShowTDP = ParamToggle("Show TD Pionts", "No|Yes", 1);
AllOrDownR = ParamToggle("Resistance ection", "All|Down");
AllOrUpS = ParamToggle("Support ection", "All|Up");
ShowSR = ParamToggle("Show Vert S/R","No|Yes", 1);
SRPer = Param("S/R Percentage", 3, 1);
SRBack = Param("S/R Back", 5, 1);
str = "";
Res = Sup = 0;
Con = 1;
////////////////////////////////////////////////////////////////////////
Main = C;
Con = ConS = ConR = 1;
if(DrawS=="Low to Low")
{
Support1 = L;
Support2 = L;
}
else
{
Support1 = L;
Support2 = H;
}
if(DrawR=="High to High")
{
Resistance1 = H;
Resistance2 = H;
}
else
{
Resistance1 = H;
Resistance2 = L;
}
////////////////////////////////////////////////////////////////////////
//Plotting Area
if(DrawAllLines)
for(i = 2; i<=Lines+1; i++)
{
if(DrawS!="Off")
{
x0 = GetXSupport(Support1, Percentage, i);
x1 = GetXSupport(Support2, Percentage, i-1);
y0 = GetYSupport(Support1, Percentage, i);
y1 = GetYSupport(Support2, Percentage, i-1);
x = LineArray(x0, y0, x1, y1, 1);
if(AllOrUpS) ConS = StrToNum(NumToStr(y0 < y1));
if(Con AND ConS)
Plot(x, "", IIf(LastValue(C) < LastValue(x), colorBlue,colorPlum), styleLine|styleThick);
}
if(DrawR!="Off")
{
x0 = GetXResistance(Resistance1, Percentage, i);
x1 = GetXResistance(Resistance2, Percentage, i-1);
y0 = GetYResistance(Resistance1, Percentage, i);
y1 = GetYResistance(Resistance2, Percentage, i-1);
x = LineArray(x0, y0, x1, y1, 1);
if(AllOrDownR) ConR = y0 > y1;
if(Con AND ConR)
Plot(x, "", IIf(LastValue(C) < LastValue(x), colorBlue,colorBlue), styleLine|styleThick);
}
}
else
{
if(DrawS!="Off")
{
x0 = GetXSupport(Support1, Percentage, Lines+1);
x1 = GetXSupport(Support2, Percentage, Lines);
y0 = GetYSupport(Support1, Percentage, Lines+1);
y1 = GetYSupport(Support2, Percentage, Lines);
x = LineArray(x0, y0, x1, y1, 1 );
Sup = LastValue(LinRegSlope(x, Lines+1));
if(AllOrUpS) ConS = y0 < y1;
if(Con AND ConS)
Plot(x, "", IIf(LastValue(C) < LastValue(x), colorBlue,colorBlue), styleLine|styleThick);
}
if(DrawR!="Off")
{
x0 = GetXResistance(Resistance1, Percentage, Lines+1);
x1 = GetXResistance(Resistance2, Percentage, Lines);
y0 = GetYResistance(Resistance1, Percentage, Lines+1);
y1 = GetYResistance(Resistance2, Percentage, Lines);
x = LineArray(x0, y0, x1, y1, 1 );
Res = LastValue(LinRegSlope(x, Lines+1));
if(AllOrDownR) ConR = y0 > y1;
if(Con AND ConR)
Plot(x, "", IIf(LastValue(C) < LastValue(x), colorBlue,colorBlue), styleLine|styleThick);
}
str = "\nR Slope=("+Res+"), S Slope=("+Sup+")";
}

if(ShowTDP)
{
}



رد مع اقتباس
قديم 04-03-2016, 11:50 PM
  المشاركه #25

عضو هوامير المميز

تاريخ التسجيل: Apr 2012
المشاركات: 194
amm1430 غير متواجد حالياً  

رد: معادلات للمضارب اللحظي على الايمى بروكر


_SECTION_BEGIN("Natraj EOD Tech Chart");
GraphXSpace = 15;_SECTION_BEGIN("???? ?????");
r1 = Param( "Fast avg", 11, 3, 20, 1 );
r2 = Param( "Slow avg", 35, 10, 35, 1 );
r3 = Param( "Signal avg", 6, 3, 20, 1 );
ml = MACD(r1, r2);
sl = Signal(r1,r2,r3);
Hst = ml-sl;
A1=EMA(C,4)-EMA(C,34);
BBtops=BBandTop(A1,10,1);
BBbots=BBandBot(A1,10,1);

Color_bar=IIf(a1>BBtops, colorBlue,IIf(a1<BBbots,colorRed,colorYellow));

bbtop = BBandTop( Hst, 10, 1 );
bbbot = BBandBot( Hst, 10,1 );

Color = IIf (Hst > BBtop,colorBlue,IIf(hst < bbbot,colorRed, IIf (Hst > 0,colorBlue,colorRed)));Buy = Cross (Hst,bbtop);Sell = Cross (bbtop,Hst);Short = Cross (bbbot,Hst);Cover = Cross (Hst,bbbot);
Plot (Close,"close",Color_bar,styleCandle);

//==============================
psh= ParamToggle("Pivot Shapes","Off|On",1);
plb= ParamToggle("Pivot Labels","Off|On",1);
snd= ParamToggle("Sound Alerts","Off|On",1);
lbk= Param("Hi Lo Lookback",350,50,5000,10);
nbz= Param("Swing Bars",5,5,150,1);
tht= Param("Hi Label Adjust",0.65,0.10,5,0.05)*ATR(5);
lbk= Min(BarCount-1,Lbk);
bc=BarCount-1;
//================
xH=H-H; xL=L-L; yH=H-H; yL=L-L; xR=H-H; xS=L-L;
xrb=0; xSb=0; yR0=0; yS0=0; xR0=0; xS0=0; xx=0;
xHH= HHVBars(H,nbz); xLL= LLVBars(L,nbz);
yHH= HHV(H,nbz); yLL= LLV(L,nbz);
viz= Status("BarVisible");
vbz= LastValue(Highest(IIf(viz,BarIndex(),0)));
_TRACE("Last visible bar: "+ vbz);
bct= (BarCount-1); = "";
if(xLL[bc]<xHH[bc]) { ="D"; } else { ="U"; }
for(i=0; i<lbk; i++) { bc=bct-i;
if(xLL[bc]<xHH[bc]) { if(=="U"){="D";
xx=bc-xLL[bc]; xL[xx]=1;
yL[xSb]=L[xx]; xS[xSb]=xx; xSb++; }
} else { if(=="D") { = "U";
xx=bc-xHH[bc]; xH[xx]=1; yH[xrb]=H[xx]; xR[xrb]=xx;xrb++; }}}
xP= 0; yP= 0; xS0= xS[0]; yS0=yL[0]; xR0= xR[0]; yR0= yH[0];
if(xS0>xR0) { xP=bc-xHH[bc]; yP= yHH[bc];
if(yR0<yP AND xP>xS0 AND xP<bc) { xH[xP]=1;
for(j=0; j<xrb; j++) { yH[xrb-j]= yH[xrb-(j+1)];
xR[xrb-j]= xR[xrb-(j+1)]; }
yH[0]= yP; xR[0]= xP; xrb++; }
} else { xP= bc-xLL[bc]; yP= yLL[bc];
if(yS0>yP AND xP>xR0 AND xP<bc) { xL[xP]=1;
for(j=0; j<xSb; j++) { yL[xSb-j]= yL[xSb-(j+1)]; xS[xSb-j]= xS[xSb-(j+1)]; }
yL[0]=yP; xS[0]=xP; xSb++; }}
ushp=shapeHollowUpArrow; dshp=shapeHollowDownArrow;
if(psh)
if(snd) {
AlertIf(xL==1,"SOUND C:\\Windows\\Media\\Windows XP Startup.wav","Audio alert",2);
AlertIf(xH==1,"SOUND C:\\Windows\\Media\\Ringin.wav","Audio alert",2); }
Buy=(xL); Sell=(xH); Cover=(xL); Short=(xH); Long=Flip(Buy,Sell); Shrt=Flip(Sell,Buy);
SellPrice=ValueWhen(Sell,H,1); BuyPrice= ValueWhen(Buy,L,1);
if(plb) {
for(i=0; i<BarCount; i++) {
if(Buy[i] )PlotText("\n\n"+ StrRight(NumToStr(L[i],6.2),10),i-1,L[i],colorWhite);
if(Sell[i])PlotText(StrRight(NumToStr(H[i],6.2),10),i-1,H[i]+tht[i],colorWhite); }
}
_SECTION_BEGIN("NICK MA Swing");
SetBarsRequired(200,0);

GraphXSpace = 5;
SetChartOptions(0,chartShowArrows|chartShowDates);
k = Optimize("K",Param("K",1,0.25,5,0.25),0.25,5,0.25);
Per= Optimize("atr",Param("atr",4,3,20,1),3,20,1);
HACLOSE=(O+H+L+C)/4;
HaOpen = AMA( Ref( HaClose, -1 ), 0.5 );
HaHigh = Max( H, Max( HaClose, HaOpen ) );
HaLow = Min( L, Min( HaClose, HaOpen ) );
j=Haclose;

//============================================================================== =========================================
//=========================Indicator============================================ ==================================================
f=ATR(14);

rfsctor = WMA(H-L, Per);

revers = k * rfsctor;

Trend = 1;
NW[0] = 0;


for(i = 1; i < BarCount; i++)
{
if(Trend[i-1] == 1)
{
if(j[i] < NW[i-1])
{
Trend[i] = -1;
NW[i] = j[i] + Revers[i];
}
else
{
Trend[i] = 1;
if((j[i] - Revers[i]) > NW[i-1])
{
NW[i] = j[i] - Revers[i];
}
else
{
NW[i] = NW[i-1];
}
}
}
if(Trend[i-1] == -1)
{
if(j[i] > NW[i-1])
{
Trend[i] = 1;
NW[i] = j[i] - Revers[i];
}
else
{
Trend[i] = -1;
if((j[i] + Revers[i]) < NW[i-1])
{
NW[i] = j[i] + Revers[i];
}
else
{
NW[i] = NW[i-1];
}
}
}
}

//===============system================

Plot(NW, "", IIf(Trend == 1, 27, 4), 4);
Buy=Cover=Cross(j,nw);
Sell=Short=Cross(nw,j);
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)+ "NICK MA Swing System" + " - " + 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)+"",""));
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-40);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-50);
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-45);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorRed, 0, H, Offset=40);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorOrange, 0,H, Offset=50);
PlotShapes(IIf(Sell, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-45);
_SECTION_END();



رد مع اقتباس
قديم 11-03-2016, 10:50 PM
  المشاركه #26

عضو هوامير المميز

تاريخ التسجيل: Apr 2012
المشاركات: 194
amm1430 غير متواجد حالياً  

رد: تثبيت اسبوعي فقط معادلات للمضارب اللحظي على الايمى بروكر


//==============================
psh= ParamToggle("Pivot Shapes","Off|On",1);
plb= ParamToggle("Pivot Labels","Off|On",1);
snd= ParamToggle("Sound Alerts","Off|On",1);
lbk= Param("Hi Lo Lookback",350,50,5000,10);
nbz= Param("Swing Bars",5,5,150,1);
tht= Param("Hi Label Adjust",0.65,0.10,5,0.05)*ATR(5);
lbk= Min(BarCount-1,Lbk);
bc=BarCount-1;
//================
xH=H-H; xL=L-L; yH=H-H; yL=L-L; xR=H-H; xS=L-L;
xrb=0; xSb=0; yR0=0; yS0=0; xR0=0; xS0=0; xx=0;
xHH= HHVBars(H,nbz); xLL= LLVBars(L,nbz);
yHH= HHV(H,nbz); yLL= LLV(L,nbz);
viz= Status("BarVisible");
vbz= LastValue(Highest(IIf(viz,BarIndex(),0)));
_TRACE("Last visible bar: "+ vbz);
bct= (BarCount-1); = "";
if(xLL[bc]<xHH[bc]) { ="D"; } else { ="U"; }
for(i=0; i<lbk; i++) { bc=bct-i;
if(xLL[bc]<xHH[bc]) { if(=="U"){="D";
xx=bc-xLL[bc]; xL[xx]=1;
yL[xSb]=L[xx]; xS[xSb]=xx; xSb++; }
} else { if(=="D") { = "U";
xx=bc-xHH[bc]; xH[xx]=1; yH[xrb]=H[xx]; xR[xrb]=xx;xrb++; }}}
xP= 0; yP= 0; xS0= xS[0]; yS0=yL[0]; xR0= xR[0]; yR0= yH[0];
if(xS0>xR0) { xP=bc-xHH[bc]; yP= yHH[bc];
if(yR0<yP AND xP>xS0 AND xP<bc) { xH[xP]=1;
for(j=0; j<xrb; j++) { yH[xrb-j]= yH[xrb-(j+1)];
xR[xrb-j]= xR[xrb-(j+1)]; }
yH[0]= yP; xR[0]= xP; xrb++; }
} else { xP= bc-xLL[bc]; yP= yLL[bc];
if(yS0>yP AND xP>xR0 AND xP<bc) { xL[xP]=1;
for(j=0; j<xSb; j++) { yL[xSb-j]= yL[xSb-(j+1)]; xS[xSb-j]= xS[xSb-(j+1)]; }
yL[0]=yP; xS[0]=xP; xSb++; }}
ushp=shapeHollowUpArrow; dshp=shapeHollowDownArrow;
if(psh)
if(snd) {
AlertIf(xL==1,"SOUND C:\\Windows\\Media\\Windows XP Startup.wav","Audio alert",2);
AlertIf(xH==1,"SOUND C:\\Windows\\Media\\Ringin.wav","Audio alert",2); }
Buy=(xL); Sell=(xH); Cover=(xL); Short=(xH); Long=Flip(Buy,Sell); Shrt=Flip(Sell,Buy);
SellPrice=ValueWhen(Sell,H,1); BuyPrice= ValueWhen(Buy,L,1);
if(plb) {
for(i=0; i<BarCount; i++) {
if(Buy[i] )PlotText("\n\n"+ StrRight(NumToStr(L[i],6.2),10),i-1,L[i],colorWhite);
if(Sell[i])PlotText(StrRight(NumToStr(H[i],6.2),10),i-1,H[i]+tht[i],colorWhite); }
}



_SECTION_BEGIN("Natraj EOD Tech Chart");
GraphXSpace = 15;_SECTION_BEGIN("???? ?????");
r1 = Param( "Fast avg", 11, 3, 20, 1 );
r2 = Param( "Slow avg", 35, 10, 35, 1 );
r3 = Param( "Signal avg", 6, 3, 20, 1 );
ml = MACD(r1, r2);
sl = Signal(r1,r2,r3);
Hst = ml-sl;
A1=EMA(C,4)-EMA(C,34);
BBtops=BBandTop(A1,10,1);
BBbots=BBandBot(A1,10,1);

Color_bar=IIf(a1>BBtops, colorBlue,IIf(a1<BBbots,colorRed,colorYellow));

bbtop = BBandTop( Hst, 10, 1 );
bbbot = BBandBot( Hst, 10,1 );

Color = IIf (Hst > BBtop,colorBlue,IIf(hst < bbbot,colorRed, IIf (Hst > 0,colorBlue,colorRed)));Buy = Cross (Hst,bbtop);Sell = Cross (bbtop,Hst);Short = Cross (bbbot,Hst);Cover = Cross (Hst,bbbot);
Plot (Close,"close",Color_bar,styleCandle);



_SECTION_BEGIN("EMA1");
P = ParamField("Price field",-1);
_SECTION_END();

PI = atan(1.00) * 4;
periods = 30;
HighHigh = HHV(H, periods);
LowLow = LLV(L, periods);
range = 25 / (HighHigh - LowLow) * LowLow;
MA1= EMA(C,200);
x1_MA = 0;
x2_MA= 1;
y1_MA= 0;
y2_MA= (Ref(MA1, -1) - MA1) / Avg * range;
c_MA= sqrt((x2_MA- x1_MA)*(x2_MA- x1_MA) + (y2_MA- y1_MA)*(y2_MA- y1_MA));
angle_MA= round(180 * acos((x2_MA - x1_MA)/c_MA) / PI);
angle_MA= IIf(y2_MA> 0, - angle_MA, angle_MA);
Col=IIf(angle_MA>3,colorWhite,IIf(angle_MA<(-3),colorRed,colorBlack));
Plot(EMA( P,200), _DEFAULT_NAME(), Col, ParamStyle("Style") );










/*
The basic definition of an 'up' fractal is a bar high that is both higher than the two bars immediately preceding it
and higher than the two bars immediately following it.
The lows of the bars are NOT considered in determining the up fractal progression.

If two bars in the progression have equal highs followed by two consecutive bars with lower highs,
then a total of six bars rather than the usual five bars will make up the progression.
The first High becomes the counting fractal. Reverse for 'down' fractals.

The 5 bar formation works best on Daily or longer time frame charts.For intraday data charts we often use 9 bar, 13 bar and 21 bar formations for fractal counting
*/
Up5BarFractal = Ref(H,-2) < H AND Ref(H,-1) < H AND Ref(H,1) < H AND Ref(H,2) < H;
Up6BarFractal = Ref(H,-2) < H AND Ref(H,-1) < H AND (H == Ref(H,1)) AND Ref(H,2) < H AND Ref(H,3) < H;
Down5BarFractal = Ref(L,-2) > L AND Ref(L,-1) > L AND Ref(L,1) > L AND Ref(L,2) > L;
Down6BarFractal = Ref(L,-2) > L AND Ref(L,-1) > L AND (L == Ref(L,1)) AND Ref(L,2) > L AND Ref(L,3) > L;

//TODO: More filtering: Show only troughs that are around atrough in trix(9).

PlotShapes( IIf(Down5BarFractal ,shapeSmallUpTriangle,0) ,colorBlack, 0, L,-12);
PlotShapes( IIf(Down6BarFractal ,shapeSmallUpTriangle,0) ,colorBlack, 0, L,-12);

PlotShapes( IIf(Up5BarFractal ,shapeSmallDownTriangle,0) ,colorBlack, 0, H,-12);
PlotShapes( IIf(Up6BarFractal ,shapeSmallDownTriangle,0) ,colorBlack, 0, H,-12);

Up = (Up5BarFractal OR Up6BarFractal);
Down = (Down5BarFractal OR Down6BarFractal);
//Removing false fractals:
DownSignal = Flip(Ref(Up,-1), Ref(Down,-1));
UpSignal = Flip(Ref(Down,-1), Ref(Up,-1));

LastHigh[0] = H[0];
LastLow[0] = L[0];

LastLowIndex = 0;
LastHighIndex = 0;
Valid = 0;
for (i=1; i < BarCount; i++)
{

LastHigh[i] = LastHigh[i-1];
LastLow[i] = LastLow[i-1];
if (Up[i])
{
Valid[i] = True;
if (DownSignal[i])
{
//Sequence of 2 Up Fractals. Validate only the higher one.
Valid[i] = H[i] >= H[LastHighIndex];
Valid[LastHighIndex] = H[LastHighIndex] > H[i];
}
LastHigh[i] = Max(H[i], H[LastHighIndex ]);
LastHighIndex = i;
}

if (Down[i])
{
Valid[i] = True;
if (UpSignal[i])
{
//Sequence of 2 Down Fractals. Validate only the lower one.
Valid[i] = L[i] <= L[LastLowIndex];
Valid[LastLowIndex] = L[LastLowIndex] < L[i];
}

LastLow[i] = Min(L[i], L[LastLowIndex]);
LastLowIndex = i;
}
}

TrixN = Trix(9);
TroughLow = Ref(TrixN, -3) > TrixN AND Ref(TrixN, -2) > TrixN AND Ref(TrixN, -1) > TrixN AND Ref(TrixN, 1) > TrixN AND Ref(TrixN, 2) > TrixN AND Ref(TrixN, 3) > TrixN;
TroughHigh = Ref(TrixN, -3) < TrixN AND Ref(TrixN, -2) < TrixN AND Ref(TrixN, -1) < TrixN AND Ref(TrixN, 1) < TrixN AND Ref(TrixN, 2) < TrixN AND Ref(TrixN, 3) < TrixN;
//TroughLow = Ref(TrixN, -2) > TrixN AND Ref(TrixN, -1) > TrixN AND Ref(TrixN, 1) > TrixN AND Ref(TrixN, 2) > TrixN;
//TroughHigh = Ref(TrixN, -2) < TrixN AND Ref(TrixN, -1) < TrixN AND Ref(TrixN, 1) < TrixN AND Ref(TrixN, 2) < TrixN;
ZeroValid = Cross(TrixN, 0) OR Cross(0, TrixN) OR Ref(Cross(TrixN, 0),1) OR Ref(Cross(0, TrixN),1);
ValidLow = TroughLow OR Ref(TroughLow, 1) OR Ref(TroughLow, 2) OR Ref(TroughLow, 3) OR Ref(TroughLow, 4);// OR Ref(TroughLow, 5));
ValidHigh = TroughHigh OR Ref(TroughHigh, 1) OR Ref(TroughHigh, 2) OR Ref(TroughHigh, 3) OR Ref(TroughHigh, 4);// OR Ref(TroughHigh, 5));

//Plot(LastHigh-10 ,"LastHigh", colorBlue, styleLine);
//Plot(LastLow-10 ,"LastLow ", colorRed, styleLine);
//Plot(Valid*5 + 10 ,"LastLow ", colorGreen, styleLine | styleThick);

//PlotShapes( IIf(Down AND Valid,shapeSmallUpTriangle,0) ,colorGreen, 0, L,-12);
//PlotShapes( IIf(Up AND Valid,shapeSmallDownTriangle,0) ,colorRed, 0, H,-12);
Maxi = Up AND (ValidHigh OR ZeroValid);
Mini = Down AND (ValidLow OR ZeroValid);
PlotShapes( IIf(Down AND (ValidLow OR ZeroValid),shapeSmallUpTriangle,0) ,colorBlue, 0, L,-12);
PlotShapes( IIf(Up AND (ValidHigh OR ZeroValid),shapeSmallDownTriangle,0) ,colorOrange, 0, H,-12);

AlertIf(Down AND (ValidLow OR ZeroValid), "SOUND C:\\Windows\\Media\\Chord.wav", "Audio alert", 2);
AlertIf(Up AND (ValidHigh OR ZeroValid), "SOUND C:\\Windows\\Media\\Ding.wav", "Audio alert", 2);
//Plot(UpSignal*3+5,"UpSignal", colorBlue, styleLine| styleThick);
//Plot(DownSignal*3 ,"DownSignal", colorRed, styleLine| styleThick);

/*
LastMaxi = 0;
LastMini = 0;
ElliotLines = 0;
State = 0;
for (i=1; i < BarCount; i++)
{
State[i] = State[i-1];
if (Maxi[i])
{
State[i] = 1;//down
}

if (Mini[i])
{
State[i] = 2;
}

}

PlotShapes(IIf(State > 0, shapeSmallCircle, 0), IIf(State == 1, colorRed, colorBlue), 0, IIf(State == 1, H, L), -5);
*/
//Line = LineArray( x0, y0, x1, y1, 1 );
//Plot( Line, "Trend line", colorBlue );

/*
Wave B
Usually 50% of Wave A
Should not exceed 75% of Wave A
Wave C
either 1 x Wave A
or 1.62 x Wave A
or 2.62 x Wave A
*/
function CorrectiveRatios(StartPrice, A, B, C, RatioDelta, Delta)
{

ALength = abs(startPrice - A); BLength = abs(A-B);
CLength = abs(B-C);

Ratio1 = BLength / CLength ;
Cond1 = Ration1 >= 0.5 - RatioDelta AND ratio1 <= 0.75 + RatioDelta;
Cond2 = abs(Clength - ALength) < Delta OR abs(Clength - 1.62 * ALength) < Delta OR abs(CLength - 2.62 * ALength) < Delta;

return Cond1 AND Cond2;
}

function ImpulseRules(StartPrice, One, Two, Three, Four, Five)
{
//Wave 2 should be beneath wave 1 start:
Cond1 = Two > StartPrice AND Two < One;
//Wave 4 - the same:
Cond2 = Four > Two AND Four < Three;
//Wave 5 should be <= wave 3
Cond3 = abs(Three-Two) >= abs(Five - Four);
//Wave 1 should be smaller than wave five, making wave 3 the biggest:
Cond4 = abs(StartPrice - One) < abs(Five - Four);
return Cond1 AND Cond2 AND Cond3 AND Cond4;
}

_SECTION_BEGIN("EMA1");
P = ParamField("Price field",-1);
_SECTION_END();

PI = atan(1.00) * 4;
periods = 30;
HighHigh = HHV(H, periods);
LowLow = LLV(L, periods);
range = 25 / (HighHigh - LowLow) * LowLow;
MA1= EMA(C,200);
x1_MA = 0;
x2_MA= 1;
y1_MA= 0;
y2_MA= (Ref(MA1, -1) - MA1) / Avg * range;
c_MA= sqrt((x2_MA- x1_MA)*(x2_MA- x1_MA) + (y2_MA- y1_MA)*(y2_MA- y1_MA));
angle_MA= round(180 * acos((x2_MA - x1_MA)/c_MA) / PI);
angle_MA= IIf(y2_MA> 0, - angle_MA, angle_MA);
Col=IIf(angle_MA>3,colorWhite,IIf(angle_MA<(-3),colorRed,colorBlack));
Plot(EMA( P,200), _DEFAULT_NAME(), Col, ParamStyle("Style") );


_SECTION_BEGIN("Natraj EOD Tech Chart");
GraphXSpace = 15;_SECTION_BEGIN("???? ?????");
r1 = Param( "Fast avg", 11, 3, 20, 1 );
r2 = Param( "Slow avg", 35, 10, 35, 1 );
r3 = Param( "Signal avg", 6, 3, 20, 1 );
ml = MACD(r1, r2);
sl = Signal(r1,r2,r3);
Hst = ml-sl;
A1=EMA(C,4)-EMA(C,34);
BBtops=BBandTop(A1,10,1);
BBbots=BBandBot(A1,10,1);

Color_bar=IIf(a1>BBtops, colorBlue,IIf(a1<BBbots,colorRed,colorYellow));

bbtop = BBandTop( Hst, 10, 1 );
bbbot = BBandBot( Hst, 10,1 );

Color = IIf (Hst > BBtop,colorBlue,IIf(hst < bbbot,colorRed, IIf (Hst > 0,colorBlue,colorRed)));Buy = Cross (Hst,bbtop);Sell = Cross (bbtop,Hst);Short = Cross (bbbot,Hst);Cover = Cross (Hst,bbbot);
Plot (Close,"close",Color_bar,styleCandle);



_SECTION_BEGIN("EMA1");
P = ParamField("Price field",-1);
_SECTION_END();

PI = atan(1.00) * 4;
periods = 30;
HighHigh = HHV(H, periods);
LowLow = LLV(L, periods);
range = 25 / (HighHigh - LowLow) * LowLow;
MA1= EMA(C,200);
x1_MA = 0;
x2_MA= 1;
y1_MA= 0;
y2_MA= (Ref(MA1, -1) - MA1) / Avg * range;
c_MA= sqrt((x2_MA- x1_MA)*(x2_MA- x1_MA) + (y2_MA- y1_MA)*(y2_MA- y1_MA));
angle_MA= round(180 * acos((x2_MA - x1_MA)/c_MA) / PI);
angle_MA= IIf(y2_MA> 0, - angle_MA, angle_MA);
Col=IIf(angle_MA>3,colorWhite,IIf(angle_MA<(-3),colorRed,colorBlack));
Plot(EMA( P,200), _DEFAULT_NAME(), Col, ParamStyle("Style") );


_SECTION_BEGIN("Intraday System_Candle_Alerts BS on 200 ema");
/* Intraday template */

GraphXSpace = 3 ;

/* These are the calcs for the oscilator values and plots the paint
bars*/
Osc = EMA(C,8) - EMA(C,34);
acc = Osc - EMA(Osc,13);
col = IIf(Osc > Ref(Osc,-1) AND acc > Ref(acc,-1),colorTurquoise,IIf(Osc < Ref(Osc,-1) AND acc < Ref(acc,-1),colorTan,colorLightBlue));
barcolor= 1;
Plot( Close, "Intraday Template" ,col/barcolor, styleCandle,styleThick|styleNoLabel);
// this sets the color of the body of the candlesticks to default

//---------------------------------------------------------------------------------

/* This is the code for the exponential moving average flipper */

mov = 200;
hi = EMA(H,mov);
lo = EMA(L,mov) ;
x1 = IIf(C>Ref(hi,-1),1,IIf(C<Ref(lo,-1),-1,0));
x2 = ValueWhen(x1!=0,x1,1);
st = IIf(x2==-1,Hi,Lo);
//Plot(st,"",colorYellow,styleNoLine|styleDots);
Buy=Cross(C,st);
Sell=Cross( Signal(), MACD() ) OR TimeNum()>151500;
Short=Cross(st,C);
Cover=Cross( MACD(), Signal() ) OR TimeNum()>151500;
shape = Buy * shapeUpTriangle + Short * shapeDownTriangle;
AlertIf( Short, "SOUND C:\\Windows\\Media\\ringout.wav", "Audio alert", 2 );
AlertIf( Buy, "SOUND C:\\Windows\\Media\\ringout.wav", "Audio alert", 2 );
PlotShapes( shape, IIf( Buy, colorYellow, colorCustom12 ),0, IIf( Buy, Low,
High ) );

GraphXSpace = 5;
dist = 2.5*ATR(10);

for( i = 0; i < BarCount; i++ )
{
if( Buy[i] ) PlotText( "Buy\n@" + C[ i ], i, L[ i ]-dist[i], colorGreen
);
if( Short[i] ) PlotText( "Short\n@" + C[ i ], i, H[ i ]+dist[i],
colorRed);
}
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g,
Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C,SelectedValue( ROC( C,
1 ) ) ));


//---------------------------------------------------------------------------------

/* This next code calculates the previous days high, low and close */

Hi1 =
IIf(Day()!=Ref(Day(),-1),Ref(HighestSince(Day()!=Ref(Day(),-1),H,1),-1),0);
Hi = ValueWhen(Day()!=Ref(Day(),-1),Hi1,1);
Lo1 =
IIf(Day()!=Ref(Day(),-1),Ref(LowestSince(Day()!=Ref(Day(),-1),L,1),-1),0);
Lo = ValueWhen(Day()!=Ref(Day(),-1),Lo1,1);
Cl1 = IIf(Day()!=Ref(Day(),-1),Ref(C,-1),0);
Cl = ValueWhen(Day()!=Ref(Day(),-1),Cl1,1);

/*This code calculates the time left in the bar*/

//File: TimeLeft in Bar
//Sept 20, 2005
// Compute Time Left In Bar
//

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");



//////////////////////////////////////////////////////////////////////////////
Filter=Buy OR Short;

AddColumn( IIf(Buy,1,IIf(Short,-1,Null)) ,"Buy/Short",1.0,colorWhite,IIf(Buy,colorDarkGreen,IIf(Short,colorRed,Null)),100);
AddColumn( IIf(Cover,2,IIf(Sell,-2,Null)) ,"Cover/Sell",1.0,colorWhite,IIf(Cover,colorLightBlue,IIf( Sell,colorCustom12,Null)),100);




_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | styleHidden | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();

_SECTION_BEGIN("BB_double_(H+L)_20");



////BOL BAND 18////////////////////////////////////////////////////////




P = ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 100, 1 );
Width = Param("Width", 2, 0, 10, 0.05 );


M = (H+L)/2;

BT = BBandTop( M, 20, 1.5 );
BB = BBandBot( M, 20, 1.5 );

BColor = ColorRGB(5,125,150);
//Plot( BT, "BBTop" + _PARAM_VALUES(), BColor, styleDots|styleThick|styleNoLabel);
//Plot( BB, "BBBot" + _PARAM_VALUES(), BColor, styleDots|styleThick|styleNoLabel);



BT1 = BBandTop( M, 20, 2.2 );
BB1 = BBandBot( M, 20, 2.2 );
//Plot( BT1, "BBTop1" + _PARAM_VALUES(), BColor, styleDots|styleNoLabel);
//Plot( BB1, "BBBot1" + _PARAM_VALUES(), BColor, styleDots|styleNoLabel);

PlotOHLC( 0, BT1 , BT , BT , "Cloud", IIf(BT1 > BT ,ColorRGB(25,25,100),colorDarkTeal), styleCloud | styleNoLabel);

PlotOHLC( 0, BB , BB1 , BB1 , "Cloud", IIf(BB > BB1 ,ColorRGB(25,25,100),colorDarkTeal), styleCloud | styleNoLabel);

_SECTION_END();Plot(EMA(C,20),"",IIf(C > EMA(C,20),colorBrightGreen,colorRed),styleLine|styleThick);



رد مع اقتباس
قديم 12-03-2016, 07:35 PM
  المشاركه #27

عضو هوامير المميز

تاريخ التسجيل: Apr 2012
المشاركات: 194
amm1430 غير متواجد حالياً  

رد: تثبيت اسبوعي فقط معادلات للمضارب اللحظي على الايمى بروكر


AddTextColumn( FullName(), "full____________ name", 77 , colorDefault );
_SECTION_BEGIN("SAR");
acc = Param("Acceleration", 0.02, 0, 1, 0.001 );
accm = Param("Max. acceleration", 0.2, 0, 1, 0.001 );
Plot( SAR( acc, accm ), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style", styleDots | styleNoLine, maskDefault | styleDots | styleNoLine ) );
_SECTION_END();
_SECTION_BEGIN("EMA CROSSOVER CHART");
LongPer = Param("Long Period", 25, 30, 100, 5);
ShortPer = Param("Short Period", 50, 30, 100, 5);
LongMA = EMA(C, LongPer);
ShortMA = EMA(C, ShortPer);
LastHigh = HHV(H, LongPer);
GraphXSpace = 10;
Buy = Cross(LongMA, ShortMA);
Short=SAR( acc, accm )>C;
Sell = Cross(ShortMA, LongMA);
Cover=SAR( acc, accm )<C;

Buy=ExRem(Buy,Sell);
Short=ExRem(Short,Cover);
Sell=ExRem(Sell,Buy);
Cover=ExRem(Cover,Short);

PlotShapes(Buy*shapeSmallUpTriangle,colorBlue ,0,L,-51);
PlotShapes(Short*shapeHollowDownTriangle,colorPink , 0,L,-45);
PlotShapes(Sell*shapeSmallDownTriangle,colorRed,0, H,-51);
PlotShapes(Cover*shapeHollowUpTriangle,colorSkyblue,0,H,-45);




per=Param("ZigZag change amount", 1, 0.1,100,0.1);
cbar = Param("cbar",4,2,50,1);
pk=PeakBars(H,per)==0;
tr=TroughBars(L,per)==0;
zzHi=Zig(H,per);
zzLo=Zig(L,per);
Avg=(zzHi+zzLo)/2;
x=IIf(pk,zzHi,IIf(tr,zzLo,IIf(Avg>Ref(Avg,-1),H,L)));
zzHiLo=Zig(x,per);
Plot( zzHiLo, "", ParamColor("Color",colorRed), ParamStyle("Style"));

pR=PeakBars(H,per)==0;
pS =TroughBars(L,per)==0;
RF=ValueWhen(pR,H);
SF=ValueWhen(pS,L);
RF1 = IIf(RF AND BarsSince(pR) <=cbar,RF,Null);
SF1 = IIf(SF AND BarsSince(pS ) <=cbar,SF,Null);
Plot(RF1,"",colorWhite,styleDots | styleNoLine);
Plot(SF1,"",colorWhite,styleDots | styleNoLine);
Plot(RF,"",colorBlack,40+16);
Plot(SF,"",colorBlack,40+16);

Buy=Cross(C,RF1);
Sell=Cross(SF1,C);
PlotShapes(IIf(Buy,shapeSmallUpTriangle,shapeNone),colorWhite,0,L,-12);
PlotShapes(IIf(Sell,shapeSmallDownTriangle, shapeNone),colorWhite,0,H,-12);
_SECTION_BEGIN("Exploration");
Filter=Close;
Var = WriteIf(Buy,"BUY",WriteIf(Sell,"SELL",""));
AddTextColumn(Var , "Buy/Sell", 1.2 , colorWhite, IIf( Buy, colorBlue,IIf(Sell,colorRed,colorWhite) ));
//==============================
psh= ParamToggle("Pivot Shapes","Off|On",1);
plb= ParamToggle("Pivot Labels","Off|On",1);
snd= ParamToggle("Sound Alerts","Off|On",1);
lbk= Param("Hi Lo Lookback",350,50,5000,10);
nbz= Param("Swing Bars",5,5,150,1);
tht= Param("Hi Label Adjust",0.65,0.10,5,0.05)*ATR(5);
lbk= Min(BarCount-1,Lbk);
bc=BarCount-1;
//================
xH=H-H; xL=L-L; yH=H-H; yL=L-L; xR=H-H; xS=L-L;
xrb=0; xSb=0; yR0=0; yS0=0; xR0=0; xS0=0; xx=0;
xHH= HHVBars(H,nbz); xLL= LLVBars(L,nbz);
yHH= HHV(H,nbz); yLL= LLV(L,nbz);
viz= Status("BarVisible");
vbz= LastValue(Highest(IIf(viz,BarIndex(),0)));
_TRACE("Last visible bar: "+ vbz);
bct= (BarCount-1); = "";
if(xLL[bc]<xHH[bc]) { ="D"; } else { ="U"; }
for(i=0; i<lbk; i++) { bc=bct-i;
if(xLL[bc]<xHH[bc]) { if(=="U"){="D";
xx=bc-xLL[bc]; xL[xx]=1;
yL[xSb]=L[xx]; xS[xSb]=xx; xSb++; }
} else { if(=="D") { = "U";
xx=bc-xHH[bc]; xH[xx]=1; yH[xrb]=H[xx]; xR[xrb]=xx;xrb++; }}}
xP= 0; yP= 0; xS0= xS[0]; yS0=yL[0]; xR0= xR[0]; yR0= yH[0];
if(xS0>xR0) { xP=bc-xHH[bc]; yP= yHH[bc];
if(yR0<yP AND xP>xS0 AND xP<bc) { xH[xP]=1;
for(j=0; j<xrb; j++) { yH[xrb-j]= yH[xrb-(j+1)];
xR[xrb-j]= xR[xrb-(j+1)]; }
yH[0]= yP; xR[0]= xP; xrb++; }
} else { xP= bc-xLL[bc]; yP= yLL[bc];
if(yS0>yP AND xP>xR0 AND xP<bc) { xL[xP]=1;
for(j=0; j<xSb; j++) { yL[xSb-j]= yL[xSb-(j+1)]; xS[xSb-j]= xS[xSb-(j+1)]; }
yL[0]=yP; xS[0]=xP; xSb++; }}
ushp=shapeHollowUpArrow; dshp=shapeHollowDownArrow;
if(psh)
if(snd) {
AlertIf(xL==1,"SOUND C:\\Windows\\Media\\Windows XP Startup.wav","Audio alert",2);
AlertIf(xH==1,"SOUND C:\\Windows\\Media\\Ringin.wav","Audio alert",2); }
Buy=(xL); Sell=(xH); Cover=(xL); Short=(xH); Long=Flip(Buy,Sell); Shrt=Flip(Sell,Buy);
SellPrice=ValueWhen(Sell,H,1); BuyPrice= ValueWhen(Buy,L,1);
if(plb) {
for(i=0; i<BarCount; i++) {
if(Buy[i] )PlotText("\n\n"+ StrRight(NumToStr(L[i],6.2),10),i-1,L[i],colorWhite);
if(Sell[i])PlotText(StrRight(NumToStr(H[i],6.2),10),i-1,H[i]+tht[i],colorWhite); }
}



_SECTION_BEGIN("Natraj EOD Tech Chart");
GraphXSpace = 15;_SECTION_BEGIN("???? ?????");
r1 = Param( "Fast avg", 11, 3, 20, 1 );
r2 = Param( "Slow avg", 35, 10, 35, 1 );
r3 = Param( "Signal avg", 6, 3, 20, 1 );
ml = MACD(r1, r2);
sl = Signal(r1,r2,r3);
Hst = ml-sl;
A1=EMA(C,4)-EMA(C,34);
BBtops=BBandTop(A1,10,1);
BBbots=BBandBot(A1,10,1);

Color_bar=IIf(a1>BBtops, colorBlue,IIf(a1<BBbots,colorRed,colorYellow));

bbtop = BBandTop( Hst, 10, 1 );
bbbot = BBandBot( Hst, 10,1 );

Color = IIf (Hst > BBtop,colorBlue,IIf(hst < bbbot,colorRed, IIf (Hst > 0,colorBlue,colorRed)));Buy = Cross (Hst,bbtop);Sell = Cross (bbtop,Hst);Short = Cross (bbbot,Hst);Cover = Cross (Hst,bbbot);
Plot (Close,"close",Color_bar,styleCandle);



_SECTION_BEGIN("EMA1");
P = ParamField("Price field",-1);
_SECTION_END();

PI = atan(1.00) * 4;
periods = 30;
HighHigh = HHV(H, periods);
LowLow = LLV(L, periods);
range = 25 / (HighHigh - LowLow) * LowLow;
MA1= EMA(C,200);
x1_MA = 0;
x2_MA= 1;
y1_MA= 0;
y2_MA= (Ref(MA1, -1) - MA1) / Avg * range;
c_MA= sqrt((x2_MA- x1_MA)*(x2_MA- x1_MA) + (y2_MA- y1_MA)*(y2_MA- y1_MA));
angle_MA= round(180 * acos((x2_MA - x1_MA)/c_MA) / PI);
angle_MA= IIf(y2_MA> 0, - angle_MA, angle_MA);
Col=IIf(angle_MA>3,colorWhite,IIf(angle_MA<(-3),colorRed,colorBlack));
Plot(EMA( P,200), _DEFAULT_NAME(), Col, ParamStyle("Style") );










/*
The basic definition of an 'up' fractal is a bar high that is both higher than the two bars immediately preceding it
and higher than the two bars immediately following it.
The lows of the bars are NOT considered in determining the up fractal progression.

If two bars in the progression have equal highs followed by two consecutive bars with lower highs,
then a total of six bars rather than the usual five bars will make up the progression.
The first High becomes the counting fractal. Reverse for 'down' fractals.

The 5 bar formation works best on Daily or longer time frame charts.For intraday data charts we often use 9 bar, 13 bar and 21 bar formations for fractal counting
*/
Up5BarFractal = Ref(H,-2) < H AND Ref(H,-1) < H AND Ref(H,1) < H AND Ref(H,2) < H;
Up6BarFractal = Ref(H,-2) < H AND Ref(H,-1) < H AND (H == Ref(H,1)) AND Ref(H,2) < H AND Ref(H,3) < H;
Down5BarFractal = Ref(L,-2) > L AND Ref(L,-1) > L AND Ref(L,1) > L AND Ref(L,2) > L;
Down6BarFractal = Ref(L,-2) > L AND Ref(L,-1) > L AND (L == Ref(L,1)) AND Ref(L,2) > L AND Ref(L,3) > L;

//TODO: More filtering: Show only troughs that are around atrough in trix(9).

PlotShapes( IIf(Down5BarFractal ,shapeSmallUpTriangle,0) ,colorBlack, 0, L,-12);
PlotShapes( IIf(Down6BarFractal ,shapeSmallUpTriangle,0) ,colorBlack, 0, L,-12);

PlotShapes( IIf(Up5BarFractal ,shapeSmallDownTriangle,0) ,colorBlack, 0, H,-12);
PlotShapes( IIf(Up6BarFractal ,shapeSmallDownTriangle,0) ,colorBlack, 0, H,-12);

Up = (Up5BarFractal OR Up6BarFractal);
Down = (Down5BarFractal OR Down6BarFractal);
//Removing false fractals:
DownSignal = Flip(Ref(Up,-1), Ref(Down,-1));
UpSignal = Flip(Ref(Down,-1), Ref(Up,-1));

LastHigh[0] = H[0];
LastLow[0] = L[0];

LastLowIndex = 0;
LastHighIndex = 0;
Valid = 0;
for (i=1; i < BarCount; i++)
{

LastHigh[i] = LastHigh[i-1];
LastLow[i] = LastLow[i-1];
if (Up[i])
{
Valid[i] = True;
if (DownSignal[i])
{
//Sequence of 2 Up Fractals. Validate only the higher one.
Valid[i] = H[i] >= H[LastHighIndex];
Valid[LastHighIndex] = H[LastHighIndex] > H[i];
}
LastHigh[i] = Max(H[i], H[LastHighIndex ]);
LastHighIndex = i;
}

if (Down[i])
{
Valid[i] = True;
if (UpSignal[i])
{
//Sequence of 2 Down Fractals. Validate only the lower one.
Valid[i] = L[i] <= L[LastLowIndex];
Valid[LastLowIndex] = L[LastLowIndex] < L[i];
}

LastLow[i] = Min(L[i], L[LastLowIndex]);
LastLowIndex = i;
}
}

TrixN = Trix(9);
TroughLow = Ref(TrixN, -3) > TrixN AND Ref(TrixN, -2) > TrixN AND Ref(TrixN, -1) > TrixN AND Ref(TrixN, 1) > TrixN AND Ref(TrixN, 2) > TrixN AND Ref(TrixN, 3) > TrixN;
TroughHigh = Ref(TrixN, -3) < TrixN AND Ref(TrixN, -2) < TrixN AND Ref(TrixN, -1) < TrixN AND Ref(TrixN, 1) < TrixN AND Ref(TrixN, 2) < TrixN AND Ref(TrixN, 3) < TrixN;
//TroughLow = Ref(TrixN, -2) > TrixN AND Ref(TrixN, -1) > TrixN AND Ref(TrixN, 1) > TrixN AND Ref(TrixN, 2) > TrixN;
//TroughHigh = Ref(TrixN, -2) < TrixN AND Ref(TrixN, -1) < TrixN AND Ref(TrixN, 1) < TrixN AND Ref(TrixN, 2) < TrixN;
ZeroValid = Cross(TrixN, 0) OR Cross(0, TrixN) OR Ref(Cross(TrixN, 0),1) OR Ref(Cross(0, TrixN),1);
ValidLow = TroughLow OR Ref(TroughLow, 1) OR Ref(TroughLow, 2) OR Ref(TroughLow, 3) OR Ref(TroughLow, 4);// OR Ref(TroughLow, 5));
ValidHigh = TroughHigh OR Ref(TroughHigh, 1) OR Ref(TroughHigh, 2) OR Ref(TroughHigh, 3) OR Ref(TroughHigh, 4);// OR Ref(TroughHigh, 5));

//Plot(LastHigh-10 ,"LastHigh", colorBlue, styleLine);
//Plot(LastLow-10 ,"LastLow ", colorRed, styleLine);
//Plot(Valid*5 + 10 ,"LastLow ", colorGreen, styleLine | styleThick);

//PlotShapes( IIf(Down AND Valid,shapeSmallUpTriangle,0) ,colorGreen, 0, L,-12);
//PlotShapes( IIf(Up AND Valid,shapeSmallDownTriangle,0) ,colorRed, 0, H,-12);
Maxi = Up AND (ValidHigh OR ZeroValid);
Mini = Down AND (ValidLow OR ZeroValid);
PlotShapes( IIf(Down AND (ValidLow OR ZeroValid),shapeSmallUpTriangle,0) ,colorBlue, 0, L,-12);
PlotShapes( IIf(Up AND (ValidHigh OR ZeroValid),shapeSmallDownTriangle,0) ,colorOrange, 0, H,-12);

AlertIf(Down AND (ValidLow OR ZeroValid), "SOUND C:\\Windows\\Media\\Chord.wav", "Audio alert", 2);
AlertIf(Up AND (ValidHigh OR ZeroValid), "SOUND C:\\Windows\\Media\\Ding.wav", "Audio alert", 2);
//Plot(UpSignal*3+5,"UpSignal", colorBlue, styleLine| styleThick);
//Plot(DownSignal*3 ,"DownSignal", colorRed, styleLine| styleThick);

/*
LastMaxi = 0;
LastMini = 0;
ElliotLines = 0;
State = 0;
for (i=1; i < BarCount; i++)
{
State[i] = State[i-1];
if (Maxi[i])
{
State[i] = 1;//down
}

if (Mini[i])
{
State[i] = 2;
}

}

PlotShapes(IIf(State > 0, shapeSmallCircle, 0), IIf(State == 1, colorRed, colorBlue), 0, IIf(State == 1, H, L), -5);
*/
//Line = LineArray( x0, y0, x1, y1, 1 );
//Plot( Line, "Trend line", colorBlue );

/*
Wave B
Usually 50% of Wave A
Should not exceed 75% of Wave A
Wave C
either 1 x Wave A
or 1.62 x Wave A
or 2.62 x Wave A
*/
function CorrectiveRatios(StartPrice, A, B, C, RatioDelta, Delta)
{

ALength = abs(startPrice - A); BLength = abs(A-B);
CLength = abs(B-C);

Ratio1 = BLength / CLength ;
Cond1 = Ration1 >= 0.5 - RatioDelta AND ratio1 <= 0.75 + RatioDelta;
Cond2 = abs(Clength - ALength) < Delta OR abs(Clength - 1.62 * ALength) < Delta OR abs(CLength - 2.62 * ALength) < Delta;

return Cond1 AND Cond2;
}

function ImpulseRules(StartPrice, One, Two, Three, Four, Five)
{
//Wave 2 should be beneath wave 1 start:
Cond1 = Two > StartPrice AND Two < One;
//Wave 4 - the same:
Cond2 = Four > Two AND Four < Three;
//Wave 5 should be <= wave 3
Cond3 = abs(Three-Two) >= abs(Five - Four);
//Wave 1 should be smaller than wave five, making wave 3 the biggest:
Cond4 = abs(StartPrice - One) < abs(Five - Four);
return Cond1 AND Cond2 AND Cond3 AND Cond4;
}

_SECTION_BEGIN("EMA1");
P = ParamField("Price field",-1);
_SECTION_END();

PI = atan(1.00) * 4;
periods = 30;
HighHigh = HHV(H, periods);
LowLow = LLV(L, periods);
range = 25 / (HighHigh - LowLow) * LowLow;
MA1= EMA(C,200);
x1_MA = 0;
x2_MA= 1;
y1_MA= 0;
y2_MA= (Ref(MA1, -1) - MA1) / Avg * range;
c_MA= sqrt((x2_MA- x1_MA)*(x2_MA- x1_MA) + (y2_MA- y1_MA)*(y2_MA- y1_MA));
angle_MA= round(180 * acos((x2_MA - x1_MA)/c_MA) / PI);
angle_MA= IIf(y2_MA> 0, - angle_MA, angle_MA);
Col=IIf(angle_MA>3,colorWhite,IIf(angle_MA<(-3),colorRed,colorBlack));
Plot(EMA( P,200), _DEFAULT_NAME(), Col, ParamStyle("Style") );


_SECTION_BEGIN("Natraj EOD Tech Chart");
GraphXSpace = 15;_SECTION_BEGIN("???? ?????");
r1 = Param( "Fast avg", 11, 3, 20, 1 );
r2 = Param( "Slow avg", 35, 10, 35, 1 );
r3 = Param( "Signal avg", 6, 3, 20, 1 );
ml = MACD(r1, r2);
sl = Signal(r1,r2,r3);
Hst = ml-sl;
A1=EMA(C,4)-EMA(C,34);
BBtops=BBandTop(A1,10,1);
BBbots=BBandBot(A1,10,1);

Color_bar=IIf(a1>BBtops, colorBlue,IIf(a1<BBbots,colorRed,colorYellow));

bbtop = BBandTop( Hst, 10, 1 );
bbbot = BBandBot( Hst, 10,1 );

Color = IIf (Hst > BBtop,colorBlue,IIf(hst < bbbot,colorRed, IIf (Hst > 0,colorBlue,colorRed)));Buy = Cross (Hst,bbtop);Sell = Cross (bbtop,Hst);Short = Cross (bbbot,Hst);Cover = Cross (Hst,bbbot);
Plot (Close,"close",Color_bar,styleCandle);



_SECTION_BEGIN("EMA1");
P = ParamField("Price field",-1);
_SECTION_END();

PI = atan(1.00) * 4;
periods = 30;
HighHigh = HHV(H, periods);
LowLow = LLV(L, periods);
range = 25 / (HighHigh - LowLow) * LowLow;
MA1= EMA(C,200);
x1_MA = 0;
x2_MA= 1;
y1_MA= 0;
y2_MA= (Ref(MA1, -1) - MA1) / Avg * range;
c_MA= sqrt((x2_MA- x1_MA)*(x2_MA- x1_MA) + (y2_MA- y1_MA)*(y2_MA- y1_MA));
angle_MA= round(180 * acos((x2_MA - x1_MA)/c_MA) / PI);
angle_MA= IIf(y2_MA> 0, - angle_MA, angle_MA);
Col=IIf(angle_MA>3,colorWhite,IIf(angle_MA<(-3),colorRed,colorBlack));
Plot(EMA( P,200), _DEFAULT_NAME(), Col, ParamStyle("Style") );


_SECTION_BEGIN("Intraday System_Candle_Alerts BS on 200 ema");
/* Intraday template */

GraphXSpace = 3 ;

/* These are the calcs for the oscilator values and plots the paint
bars*/
Osc = EMA(C,8) - EMA(C,34);
acc = Osc - EMA(Osc,13);
col = IIf(Osc > Ref(Osc,-1) AND acc > Ref(acc,-1),colorTurquoise,IIf(Osc < Ref(Osc,-1) AND acc < Ref(acc,-1),colorTan,colorLightBlue));
barcolor= 1;
Plot( Close, "Intraday Template" ,col/barcolor, styleCandle,styleThick|styleNoLabel);
// this sets the color of the body of the candlesticks to default

//---------------------------------------------------------------------------------

/* This is the code for the exponential moving average flipper */

mov = 200;
hi = EMA(H,mov);
lo = EMA(L,mov) ;
x1 = IIf(C>Ref(hi,-1),1,IIf(C<Ref(lo,-1),-1,0));
x2 = ValueWhen(x1!=0,x1,1);
st = IIf(x2==-1,Hi,Lo);
//Plot(st,"",colorYellow,styleNoLine|styleDots);
Buy=Cross(C,st);
Sell=Cross( Signal(), MACD() ) OR TimeNum()>151500;
Short=Cross(st,C);
Cover=Cross( MACD(), Signal() ) OR TimeNum()>151500;
shape = Buy * shapeUpTriangle + Short * shapeDownTriangle;
AlertIf( Short, "SOUND C:\\Windows\\Media\\ringout.wav", "Audio alert", 2 );
AlertIf( Buy, "SOUND C:\\Windows\\Media\\ringout.wav", "Audio alert", 2 );
PlotShapes( shape, IIf( Buy, colorYellow, colorCustom12 ),0, IIf( Buy, Low,
High ) );

GraphXSpace = 5;
dist = 2.5*ATR(10);

for( i = 0; i < BarCount; i++ )
{
if( Buy[i] ) PlotText( "Buy\n@" + C[ i ], i, L[ i ]-dist[i], colorGreen
);
if( Short[i] ) PlotText( "Short\n@" + C[ i ], i, H[ i ]+dist[i],
colorRed);
}
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g,
Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C,SelectedValue( ROC( C,
1 ) ) ));


//---------------------------------------------------------------------------------

/* This next code calculates the previous days high, low and close */

Hi1 =
IIf(Day()!=Ref(Day(),-1),Ref(HighestSince(Day()!=Ref(Day(),-1),H,1),-1),0);
Hi = ValueWhen(Day()!=Ref(Day(),-1),Hi1,1);
Lo1 =
IIf(Day()!=Ref(Day(),-1),Ref(LowestSince(Day()!=Ref(Day(),-1),L,1),-1),0);
Lo = ValueWhen(Day()!=Ref(Day(),-1),Lo1,1);
Cl1 = IIf(Day()!=Ref(Day(),-1),Ref(C,-1),0);
Cl = ValueWhen(Day()!=Ref(Day(),-1),Cl1,1);

/*This code calculates the time left in the bar*/

//File: TimeLeft in Bar
//Sept 20, 2005
// Compute Time Left In Bar
//

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");



//////////////////////////////////////////////////////////////////////////////
Filter=Buy OR Short;

AddColumn( IIf(Buy,1,IIf(Short,-1,Null)) ,"Buy/Short",1.0,colorWhite,IIf(Buy,colorDarkGreen,IIf(Short,colorRed,Null)),100);
AddColumn( IIf(Cover,2,IIf(Sell,-2,Null)) ,"Cover/Sell",1.0,colorWhite,IIf(Cover,colorLightBlue,IIf( Sell,colorCustom12,Null)),100);




_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | styleHidden | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();

_SECTION_BEGIN("BB_double_(H+L)_20");



////BOL BAND 18////////////////////////////////////////////////////////




P = ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 100, 1 );
Width = Param("Width", 2, 0, 10, 0.05 );


M = (H+L)/2;

BT = BBandTop( M, 20, 1.5 );
BB = BBandBot( M, 20, 1.5 );

BColor = ColorRGB(5,125,150);
//Plot( BT, "BBTop" + _PARAM_VALUES(), BColor, styleDots|styleThick|styleNoLabel);
//Plot( BB, "BBBot" + _PARAM_VALUES(), BColor, styleDots|styleThick|styleNoLabel);



BT1 = BBandTop( M, 20, 2.2 );
BB1 = BBandBot( M, 20, 2.2 );
//Plot( BT1, "BBTop1" + _PARAM_VALUES(), BColor, styleDots|styleNoLabel);
//Plot( BB1, "BBBot1" + _PARAM_VALUES(), BColor, styleDots|styleNoLabel);

PlotOHLC( 0, BT1 , BT , BT , "Cloud", IIf(BT1 > BT ,ColorRGB(25,25,100),colorDarkTeal), styleCloud | styleNoLabel);

PlotOHLC( 0, BB , BB1 , BB1 , "Cloud", IIf(BB > BB1 ,ColorRGB(25,25,100),colorDarkTeal), styleCloud | styleNoLabel);

_SECTION_END();Plot(EMA(C,20),"",IIf(C > EMA(C,20),colorBrightGreen,colorRed),styleLine|styleThick);


_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();



رد مع اقتباس
قديم 18-03-2016, 01:41 PM
  المشاركه #28

عضو هوامير المميز

تاريخ التسجيل: Jul 2005
المشاركات: 1,296
أسعار غير متواجد حالياً  

رد: معادلات للمضارب اللحظي على الايمى بروكر


الف شكر اخوي amm1430

لكن ياليتك فرقت بين المعادلات او ارفقتها نكون ممنونين



رد مع اقتباس
قديم 19-03-2016, 02:04 AM
  المشاركه #29

عضو هوامير المميز

تاريخ التسجيل: Oct 2011
المشاركات: 232
fhfh1 غير متواجد حالياً  

رد: معادلات للمضارب اللحظي على الايمى بروكر


ممكن البرنامج مع الكراك اغلب الموجوده بالموقع غير موجود بالرابط او تم ازالته
مشكورين
( الايمي بروكر )



رد مع اقتباس
قديم 20-03-2016, 10:24 PM
  المشاركه #30

عضو هوامير المميز

تاريخ التسجيل: Apr 2012
المشاركات: 194
amm1430 غير متواجد حالياً  

رد: معادلات للمضارب اللحظي على الايمى بروكر


[QUOTE=أسعار;33410222]الف شكر اخوي amm1430

لكن ياليتك فرقت بين المعادلات او ارفقتها نكون ممنونين
[/QUOTE
يعطيك العافيه اخوى تفضل المعادله الاخيره

























AddTextColumn( FullName(), "full____________ name", 77 , colorDefault );


_SECTION_BEGIN("Natraj EOD Tech Chart");
GraphXSpace = 15;_SECTION_BEGIN("???? ?????");
r1 = Param( "Fast avg", 11, 3, 20, 1 );
r2 = Param( "Slow avg", 35, 10, 35, 1 );
r3 = Param( "Signal avg", 6, 3, 20, 1 );
ml = MACD(r1, r2);
sl = Signal(r1,r2,r3);
Hst = ml-sl;
A1=EMA(C,4)-EMA(C,34);
BBtops=BBandTop(A1,10,1);
BBbots=BBandBot(A1,10,1);

Color_bar=IIf(a1>BBtops, colorBlue,IIf(a1<BBbots,colorRed,colorYellow));

bbtop = BBandTop( Hst, 10, 1 );
bbbot = BBandBot( Hst, 10,1 );

Color = IIf (Hst > BBtop,colorBlue,IIf(hst < bbbot,colorRed, IIf (Hst > 0,colorBlue,colorRed)));Buy = Cross (Hst,bbtop);Sell = Cross (bbtop,Hst);Short = Cross (bbbot,Hst);Cover = Cross (Hst,bbbot);
Plot (Close,"close",Color_bar,styleCandle);

_SECTION_BEGIN("SAR");
acc = Param("Acceleration", 0.02, 0, 1, 0.001 );
accm = Param("Max. acceleration", 0.2, 0, 1, 0.001 );
Plot( SAR( acc, accm ), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style", styleDots | styleNoLine, maskDefault | styleDots | styleNoLine ) );
_SECTION_END();
_SECTION_BEGIN("EMA CROSSOVER CHART");
LongPer = Param("Long Period", 25, 30, 100, 5);
ShortPer = Param("Short Period", 50, 30, 100, 5);
LongMA = EMA(C, LongPer);
ShortMA = EMA(C, ShortPer);
LastHigh = HHV(H, LongPer);
GraphXSpace = 10;
Buy = Cross(LongMA, ShortMA);
Short=SAR( acc, accm )>C;
Sell = Cross(ShortMA, LongMA);
Cover=SAR( acc, accm )<C;

Buy=ExRem(Buy,Sell);
Short=ExRem(Short,Cover);
Sell=ExRem(Sell,Buy);
Cover=ExRem(Cover,Short);

PlotShapes(Buy*shapeSmallUpTriangle,colorBlue ,0,L,-51);
PlotShapes(Short*shapeHollowDownTriangle,colorPink , 0,L,-45);
PlotShapes(Sell*shapeSmallDownTriangle,colorRed,0, H,-51);
PlotShapes(Cover*shapeHollowUpTriangle,colorSkyblue,0,H,-45);




per=Param("ZigZag change amount", 1, 0.1,100,0.1);
cbar = Param("cbar",4,2,50,1);
pk=PeakBars(H,per)==0;
tr=TroughBars(L,per)==0;
zzHi=Zig(H,per);
zzLo=Zig(L,per);
Avg=(zzHi+zzLo)/2;
x=IIf(pk,zzHi,IIf(tr,zzLo,IIf(Avg>Ref(Avg,-1),H,L)));
zzHiLo=Zig(x,per);
Plot( zzHiLo, "", ParamColor("Color",colorRed), ParamStyle("Style"));

pR=PeakBars(H,per)==0;
pS =TroughBars(L,per)==0;
RF=ValueWhen(pR,H);
SF=ValueWhen(pS,L);
RF1 = IIf(RF AND BarsSince(pR) <=cbar,RF,Null);
SF1 = IIf(SF AND BarsSince(pS ) <=cbar,SF,Null);
Plot(RF1,"",colorWhite,styleDots | styleNoLine);
Plot(SF1,"",colorWhite,styleDots | styleNoLine);
Plot(RF,"",colorBlack,40+16);
Plot(SF,"",colorBlack,40+16);

Buy=Cross(C,RF1);
Sell=Cross(SF1,C);
PlotShapes(IIf(Buy,shapeSmallUpTriangle,shapeNone),colorWhite,0,L,-12);
PlotShapes(IIf(Sell,shapeSmallDownTriangle, shapeNone),colorWhite,0,H,-12);
_SECTION_BEGIN("Exploration");
Filter=Close;
Var = WriteIf(Buy,"BUY",WriteIf(Sell,"SELL",""));
AddTextColumn(Var , "Buy/Sell", 1.2 , colorWhite, IIf( Buy, colorBlue,IIf(Sell,colorRed,colorWhite) ));
//==============================
psh= ParamToggle("Pivot Shapes","Off|On",1);
plb= ParamToggle("Pivot Labels","Off|On",1);
snd= ParamToggle("Sound Alerts","Off|On",1);
lbk= Param("Hi Lo Lookback",350,50,5000,10);
nbz= Param("Swing Bars",5,5,150,1);
tht= Param("Hi Label Adjust",0.65,0.10,5,0.05)*ATR(5);
lbk= Min(BarCount-1,Lbk);
bc=BarCount-1;
//================
xH=H-H; xL=L-L; yH=H-H; yL=L-L; xR=H-H; xS=L-L;
xrb=0; xSb=0; yR0=0; yS0=0; xR0=0; xS0=0; xx=0;
xHH= HHVBars(H,nbz); xLL= LLVBars(L,nbz);
yHH= HHV(H,nbz); yLL= LLV(L,nbz);
viz= Status("BarVisible");
vbz= LastValue(Highest(IIf(viz,BarIndex(),0)));
_TRACE("Last visible bar: "+ vbz);
bct= (BarCount-1); = "";
if(xLL[bc]<xHH[bc]) { ="D"; } else { ="U"; }
for(i=0; i<lbk; i++) { bc=bct-i;
if(xLL[bc]<xHH[bc]) { if(=="U"){="D";
xx=bc-xLL[bc]; xL[xx]=1;
yL[xSb]=L[xx]; xS[xSb]=xx; xSb++; }
} else { if(=="D") { = "U";
xx=bc-xHH[bc]; xH[xx]=1; yH[xrb]=H[xx]; xR[xrb]=xx;xrb++; }}}
xP= 0; yP= 0; xS0= xS[0]; yS0=yL[0]; xR0= xR[0]; yR0= yH[0];
if(xS0>xR0) { xP=bc-xHH[bc]; yP= yHH[bc];
if(yR0<yP AND xP>xS0 AND xP<bc) { xH[xP]=1;
for(j=0; j<xrb; j++) { yH[xrb-j]= yH[xrb-(j+1)];
xR[xrb-j]= xR[xrb-(j+1)]; }
yH[0]= yP; xR[0]= xP; xrb++; }
} else { xP= bc-xLL[bc]; yP= yLL[bc];
if(yS0>yP AND xP>xR0 AND xP<bc) { xL[xP]=1;
for(j=0; j<xSb; j++) { yL[xSb-j]= yL[xSb-(j+1)]; xS[xSb-j]= xS[xSb-(j+1)]; }
yL[0]=yP; xS[0]=xP; xSb++; }}
ushp=shapeHollowUpArrow; dshp=shapeHollowDownArrow;
if(psh)
if(snd) {
AlertIf(xL==1,"SOUND C:\\Windows\\Media\\Windows XP Startup.wav","Audio alert",2);
AlertIf(xH==1,"SOUND C:\\Windows\\Media\\Ringin.wav","Audio alert",2); }
Buy=(xL); Sell=(xH); Cover=(xL); Short=(xH); Long=Flip(Buy,Sell); Shrt=Flip(Sell,Buy);
SellPrice=ValueWhen(Sell,H,1); BuyPrice= ValueWhen(Buy,L,1);
if(plb) {
for(i=0; i<BarCount; i++) {
if(Buy[i] )PlotText("\n\n"+ StrRight(NumToStr(L[i],6.2),10),i-1,L[i],colorWhite);
if(Sell[i])PlotText(StrRight(NumToStr(H[i],6.2),10),i-1,H[i]+tht[i],colorWhite); }
}






_SECTION_BEGIN("EMA1");
P = ParamField("Price field",-1);
_SECTION_END();

PI = atan(1.00) * 4;
periods = 30;
HighHigh = HHV(H, periods);
LowLow = LLV(L, periods);
range = 25 / (HighHigh - LowLow) * LowLow;
MA1= EMA(C,200);
x1_MA = 0;
x2_MA= 1;
y1_MA= 0;
y2_MA= (Ref(MA1, -1) - MA1) / Avg * range;
c_MA= sqrt((x2_MA- x1_MA)*(x2_MA- x1_MA) + (y2_MA- y1_MA)*(y2_MA- y1_MA));
angle_MA= round(180 * acos((x2_MA - x1_MA)/c_MA) / PI);
angle_MA= IIf(y2_MA> 0, - angle_MA, angle_MA);
Col=IIf(angle_MA>3,colorWhite,IIf(angle_MA<(-3),colorRed,colorBlack));
Plot(EMA( P,200), _DEFAULT_NAME(), Col, ParamStyle("Style") );










/*
The basic definition of an 'up' fractal is a bar high that is both higher than the two bars immediately preceding it
and higher than the two bars immediately following it.
The lows of the bars are NOT considered in determining the up fractal progression.

If two bars in the progression have equal highs followed by two consecutive bars with lower highs,
then a total of six bars rather than the usual five bars will make up the progression.
The first High becomes the counting fractal. Reverse for 'down' fractals.

The 5 bar formation works best on Daily or longer time frame charts.For intraday data charts we often use 9 bar, 13 bar and 21 bar formations for fractal counting
*/
Up5BarFractal = Ref(H,-2) < H AND Ref(H,-1) < H AND Ref(H,1) < H AND Ref(H,2) < H;
Up6BarFractal = Ref(H,-2) < H AND Ref(H,-1) < H AND (H == Ref(H,1)) AND Ref(H,2) < H AND Ref(H,3) < H;
Down5BarFractal = Ref(L,-2) > L AND Ref(L,-1) > L AND Ref(L,1) > L AND Ref(L,2) > L;
Down6BarFractal = Ref(L,-2) > L AND Ref(L,-1) > L AND (L == Ref(L,1)) AND Ref(L,2) > L AND Ref(L,3) > L;

//TODO: More filtering: Show only troughs that are around atrough in trix(9).

PlotShapes( IIf(Down5BarFractal ,shapeSmallUpTriangle,0) ,colorBlack, 0, L,-12);
PlotShapes( IIf(Down6BarFractal ,shapeSmallUpTriangle,0) ,colorBlack, 0, L,-12);

PlotShapes( IIf(Up5BarFractal ,shapeSmallDownTriangle,0) ,colorBlack, 0, H,-12);
PlotShapes( IIf(Up6BarFractal ,shapeSmallDownTriangle,0) ,colorBlack, 0, H,-12);

Up = (Up5BarFractal OR Up6BarFractal);
Down = (Down5BarFractal OR Down6BarFractal);
//Removing false fractals:
DownSignal = Flip(Ref(Up,-1), Ref(Down,-1));
UpSignal = Flip(Ref(Down,-1), Ref(Up,-1));

LastHigh[0] = H[0];
LastLow[0] = L[0];

LastLowIndex = 0;
LastHighIndex = 0;
Valid = 0;
for (i=1; i < BarCount; i++)
{

LastHigh[i] = LastHigh[i-1];
LastLow[i] = LastLow[i-1];
if (Up[i])
{
Valid[i] = True;
if (DownSignal[i])
{
//Sequence of 2 Up Fractals. Validate only the higher one.
Valid[i] = H[i] >= H[LastHighIndex];
Valid[LastHighIndex] = H[LastHighIndex] > H[i];
}
LastHigh[i] = Max(H[i], H[LastHighIndex ]);
LastHighIndex = i;
}

if (Down[i])
{
Valid[i] = True;
if (UpSignal[i])
{
//Sequence of 2 Down Fractals. Validate only the lower one.
Valid[i] = L[i] <= L[LastLowIndex];
Valid[LastLowIndex] = L[LastLowIndex] < L[i];
}

LastLow[i] = Min(L[i], L[LastLowIndex]);
LastLowIndex = i;
}
}

TrixN = Trix(9);
TroughLow = Ref(TrixN, -3) > TrixN AND Ref(TrixN, -2) > TrixN AND Ref(TrixN, -1) > TrixN AND Ref(TrixN, 1) > TrixN AND Ref(TrixN, 2) > TrixN AND Ref(TrixN, 3) > TrixN;
TroughHigh = Ref(TrixN, -3) < TrixN AND Ref(TrixN, -2) < TrixN AND Ref(TrixN, -1) < TrixN AND Ref(TrixN, 1) < TrixN AND Ref(TrixN, 2) < TrixN AND Ref(TrixN, 3) < TrixN;
//TroughLow = Ref(TrixN, -2) > TrixN AND Ref(TrixN, -1) > TrixN AND Ref(TrixN, 1) > TrixN AND Ref(TrixN, 2) > TrixN;
//TroughHigh = Ref(TrixN, -2) < TrixN AND Ref(TrixN, -1) < TrixN AND Ref(TrixN, 1) < TrixN AND Ref(TrixN, 2) < TrixN;
ZeroValid = Cross(TrixN, 0) OR Cross(0, TrixN) OR Ref(Cross(TrixN, 0),1) OR Ref(Cross(0, TrixN),1);
ValidLow = TroughLow OR Ref(TroughLow, 1) OR Ref(TroughLow, 2) OR Ref(TroughLow, 3) OR Ref(TroughLow, 4);// OR Ref(TroughLow, 5));
ValidHigh = TroughHigh OR Ref(TroughHigh, 1) OR Ref(TroughHigh, 2) OR Ref(TroughHigh, 3) OR Ref(TroughHigh, 4);// OR Ref(TroughHigh, 5));

//Plot(LastHigh-10 ,"LastHigh", colorBlue, styleLine);
//Plot(LastLow-10 ,"LastLow ", colorRed, styleLine);
//Plot(Valid*5 + 10 ,"LastLow ", colorGreen, styleLine | styleThick);

//PlotShapes( IIf(Down AND Valid,shapeSmallUpTriangle,0) ,colorGreen, 0, L,-12);
//PlotShapes( IIf(Up AND Valid,shapeSmallDownTriangle,0) ,colorRed, 0, H,-12);
Maxi = Up AND (ValidHigh OR ZeroValid);
Mini = Down AND (ValidLow OR ZeroValid);
PlotShapes( IIf(Down AND (ValidLow OR ZeroValid),shapeSmallUpTriangle,0) ,colorBlue, 0, L,-12);
PlotShapes( IIf(Up AND (ValidHigh OR ZeroValid),shapeSmallDownTriangle,0) ,colorOrange, 0, H,-12);

AlertIf(Down AND (ValidLow OR ZeroValid), "SOUND C:\\Windows\\Media\\Chord.wav", "Audio alert", 2);
AlertIf(Up AND (ValidHigh OR ZeroValid), "SOUND C:\\Windows\\Media\\Ding.wav", "Audio alert", 2);
//Plot(UpSignal*3+5,"UpSignal", colorBlue, styleLine| styleThick);
//Plot(DownSignal*3 ,"DownSignal", colorRed, styleLine| styleThick);

/*
LastMaxi = 0;
LastMini = 0;
ElliotLines = 0;
State = 0;
for (i=1; i < BarCount; i++)
{
State[i] = State[i-1];
if (Maxi[i])
{
State[i] = 1;//down
}

if (Mini[i])
{
State[i] = 2;
}

}

PlotShapes(IIf(State > 0, shapeSmallCircle, 0), IIf(State == 1, colorRed, colorBlue), 0, IIf(State == 1, H, L), -5);
*/
//Line = LineArray( x0, y0, x1, y1, 1 );
//Plot( Line, "Trend line", colorBlue );

/*
Wave B
Usually 50% of Wave A
Should not exceed 75% of Wave A
Wave C
either 1 x Wave A
or 1.62 x Wave A
or 2.62 x Wave A
*/
function CorrectiveRatios(StartPrice, A, B, C, RatioDelta, Delta)
{

ALength = abs(startPrice - A); BLength = abs(A-B);
CLength = abs(B-C);

Ratio1 = BLength / CLength ;
Cond1 = Ration1 >= 0.5 - RatioDelta AND ratio1 <= 0.75 + RatioDelta;
Cond2 = abs(Clength - ALength) < Delta OR abs(Clength - 1.62 * ALength) < Delta OR abs(CLength - 2.62 * ALength) < Delta;

return Cond1 AND Cond2;
}

function ImpulseRules(StartPrice, One, Two, Three, Four, Five)
{
//Wave 2 should be beneath wave 1 start:
Cond1 = Two > StartPrice AND Two < One;
//Wave 4 - the same:
Cond2 = Four > Two AND Four < Three;
//Wave 5 should be <= wave 3
Cond3 = abs(Three-Two) >= abs(Five - Four);
//Wave 1 should be smaller than wave five, making wave 3 the biggest:
Cond4 = abs(StartPrice - One) < abs(Five - Four);
return Cond1 AND Cond2 AND Cond3 AND Cond4;
}

_SECTION_BEGIN("EMA1");
P = ParamField("Price field",-1);
_SECTION_END();

PI = atan(1.00) * 4;
periods = 30;
HighHigh = HHV(H, periods);
LowLow = LLV(L, periods);
range = 25 / (HighHigh - LowLow) * LowLow;
MA1= EMA(C,200);
x1_MA = 0;
x2_MA= 1;
y1_MA= 0;
y2_MA= (Ref(MA1, -1) - MA1) / Avg * range;
c_MA= sqrt((x2_MA- x1_MA)*(x2_MA- x1_MA) + (y2_MA- y1_MA)*(y2_MA- y1_MA));
angle_MA= round(180 * acos((x2_MA - x1_MA)/c_MA) / PI);
angle_MA= IIf(y2_MA> 0, - angle_MA, angle_MA);
Col=IIf(angle_MA>3,colorWhite,IIf(angle_MA<(-3),colorRed,colorBlack));
Plot(EMA( P,200), _DEFAULT_NAME(), Col, ParamStyle("Style") );


_SECTION_BEGIN("Natraj EOD Tech Chart");
GraphXSpace = 15;_SECTION_BEGIN("???? ?????");
r1 = Param( "Fast avg", 11, 3, 20, 1 );
r2 = Param( "Slow avg", 35, 10, 35, 1 );
r3 = Param( "Signal avg", 6, 3, 20, 1 );
ml = MACD(r1, r2);
sl = Signal(r1,r2,r3);
Hst = ml-sl;
A1=EMA(C,4)-EMA(C,34);
BBtops=BBandTop(A1,10,1);
BBbots=BBandBot(A1,10,1);

Color_bar=IIf(a1>BBtops, colorBlue,IIf(a1<BBbots,colorRed,colorYellow));

bbtop = BBandTop( Hst, 10, 1 );
bbbot = BBandBot( Hst, 10,1 );

Color = IIf (Hst > BBtop,colorBlue,IIf(hst < bbbot,colorRed, IIf (Hst > 0,colorBlue,colorRed)));Buy = Cross (Hst,bbtop);Sell = Cross (bbtop,Hst);Short = Cross (bbbot,Hst);Cover = Cross (Hst,bbbot);
Plot (Close,"close",Color_bar,styleCandle);



_SECTION_BEGIN("EMA1");
P = ParamField("Price field",-1);
_SECTION_END();

PI = atan(1.00) * 4;
periods = 30;
HighHigh = HHV(H, periods);
LowLow = LLV(L, periods);
range = 25 / (HighHigh - LowLow) * LowLow;
MA1= EMA(C,200);
x1_MA = 0;
x2_MA= 1;
y1_MA= 0;
y2_MA= (Ref(MA1, -1) - MA1) / Avg * range;
c_MA= sqrt((x2_MA- x1_MA)*(x2_MA- x1_MA) + (y2_MA- y1_MA)*(y2_MA- y1_MA));
angle_MA= round(180 * acos((x2_MA - x1_MA)/c_MA) / PI);
angle_MA= IIf(y2_MA> 0, - angle_MA, angle_MA);
Col=IIf(angle_MA>3,colorWhite,IIf(angle_MA<(-3),colorRed,colorBlack));
Plot(EMA( P,200), _DEFAULT_NAME(), Col, ParamStyle("Style") );


_SECTION_BEGIN("Intraday System_Candle_Alerts BS on 200 ema");
/* Intraday template */

GraphXSpace = 3 ;

/* These are the calcs for the oscilator values and plots the paint
bars*/
Osc = EMA(C,8) - EMA(C,34);
acc = Osc - EMA(Osc,13);
col = IIf(Osc > Ref(Osc,-1) AND acc > Ref(acc,-1),colorTurquoise,IIf(Osc < Ref(Osc,-1) AND acc < Ref(acc,-1),colorTan,colorLightBlue));
barcolor= 1;
Plot( Close, "Intraday Template" ,col/barcolor, styleCandle,styleThick|styleNoLabel);
// this sets the color of the body of the candlesticks to default

//---------------------------------------------------------------------------------

/* This is the code for the exponential moving average flipper */

mov = 200;
hi = EMA(H,mov);
lo = EMA(L,mov) ;
x1 = IIf(C>Ref(hi,-1),1,IIf(C<Ref(lo,-1),-1,0));
x2 = ValueWhen(x1!=0,x1,1);
st = IIf(x2==-1,Hi,Lo);
//Plot(st,"",colorYellow,styleNoLine|styleDots);
Buy=Cross(C,st);
Sell=Cross( Signal(), MACD() ) OR TimeNum()>151500;
Short=Cross(st,C);
Cover=Cross( MACD(), Signal() ) OR TimeNum()>151500;
shape = Buy * shapeUpTriangle + Short * shapeDownTriangle;
AlertIf( Short, "SOUND C:\\Windows\\Media\\ringout.wav", "Audio alert", 2 );
AlertIf( Buy, "SOUND C:\\Windows\\Media\\ringout.wav", "Audio alert", 2 );
PlotShapes( shape, IIf( Buy, colorYellow, colorCustom12 ),0, IIf( Buy, Low,
High ) );

GraphXSpace = 5;
dist = 2.5*ATR(10);

for( i = 0; i < BarCount; i++ )
{
if( Buy[i] ) PlotText( "Buy\n@" + C[ i ], i, L[ i ]-dist[i], colorGreen
);
if( Short[i] ) PlotText( "Short\n@" + C[ i ], i, H[ i ]+dist[i],
colorRed);
}
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g,
Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C,SelectedValue( ROC( C,
1 ) ) ));


//---------------------------------------------------------------------------------

/* This next code calculates the previous days high, low and close */

Hi1 =
IIf(Day()!=Ref(Day(),-1),Ref(HighestSince(Day()!=Ref(Day(),-1),H,1),-1),0);
Hi = ValueWhen(Day()!=Ref(Day(),-1),Hi1,1);
Lo1 =
IIf(Day()!=Ref(Day(),-1),Ref(LowestSince(Day()!=Ref(Day(),-1),L,1),-1),0);
Lo = ValueWhen(Day()!=Ref(Day(),-1),Lo1,1);
Cl1 = IIf(Day()!=Ref(Day(),-1),Ref(C,-1),0);
Cl = ValueWhen(Day()!=Ref(Day(),-1),Cl1,1);

/*This code calculates the time left in the bar*/

//File: TimeLeft in Bar
//Sept 20, 2005
// Compute Time Left In Bar
//

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");



//////////////////////////////////////////////////////////////////////////////
Filter=Buy OR Short;

AddColumn( IIf(Buy,1,IIf(Short,-1,Null)) ,"Buy/Short",1.0,colorWhite,IIf(Buy,colorDarkGreen,IIf(Short,colorRed,Null)),100);
AddColumn( IIf(Cover,2,IIf(Sell,-2,Null)) ,"Cover/Sell",1.0,colorWhite,IIf(Cover,colorLightBlue,IIf( Sell,colorCustom12,Null)),100);




_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | styleHidden | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();

_SECTION_BEGIN("BB_double_(H+L)_20");



////BOL BAND 18////////////////////////////////////////////////////////




P = ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 100, 1 );
Width = Param("Width", 2, 0, 10, 0.05 );


M = (H+L)/2;

BT = BBandTop( M, 20, 1.5 );
BB = BBandBot( M, 20, 1.5 );

BColor = ColorRGB(5,125,150);
//Plot( BT, "BBTop" + _PARAM_VALUES(), BColor, styleDots|styleThick|styleNoLabel);
//Plot( BB, "BBBot" + _PARAM_VALUES(), BColor, styleDots|styleThick|styleNoLabel);



BT1 = BBandTop( M, 20, 2.2 );
BB1 = BBandBot( M, 20, 2.2 );
//Plot( BT1, "BBTop1" + _PARAM_VALUES(), BColor, styleDots|styleNoLabel);
//Plot( BB1, "BBBot1" + _PARAM_VALUES(), BColor, styleDots|styleNoLabel);

PlotOHLC( 0, BT1 , BT , BT , "Cloud", IIf(BT1 > BT ,ColorRGB(25,25,100),colorDarkTeal), styleCloud | styleNoLabel);

PlotOHLC( 0, BB , BB1 , BB1 , "Cloud", IIf(BB > BB1 ,ColorRGB(25,25,100),colorDarkTeal), styleCloud | styleNoLabel);

_SECTION_END();Plot(EMA(C,20),"",IIf(C > EMA(C,20),colorBrightGreen,colorRed),styleLine|styleThick);


_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();



رد مع اقتباس
إضافة رد


مواقع النشر (المفضلة)

الكلمات الدلالية (Tags)
للمضارب, معادلات, اللحظي, الايمى, بروكر, على

أدوات الموضوع
انواع عرض الموضوع

تعليمات المشاركة
لا تستطيع إضافة مواضيع جديدة
لا تستطيع الرد على المواضيع
لا تستطيع إرفاق ملفات
لا تستطيع تعديل مشاركاتك

BB code is متاحة
كود [IMG] متاحة
كود HTML معطلة

الانتقال السريع



06:08 PM