Jump to content

save2009

Members
  • Posts

    156
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by save2009

  1. Hi All

     

    Can anyone help to convert this metastock code to MT4 expert advisor code.

    This code from Detecting Breakouts From Flags & Pennants strategy.

    More info please go to this link

    http://www.forexsharing.com/457475

     

    //BUY
    ZZ:=Zig(C,17,%);
    X:=BarsSince(ZZ<Ref(ZZ,-1)AND Ref(ZZ,-1)>Ref(ZZ,-2));
    X1:=LASTVALUE(X)+1; {flag duration}
    X2:=X1+1;
    SD:=Stdev(C,X2);
    PERIOD:=22;
    COEF:=.1;
    INTRA:=Log(H)-Log(L);
    VINTRA:=Stdev(INTRA,PERIOD);
    INTER:=Log(Typical())-Log(Ref(Typical(),-1));
    VINTER:=Stdev(INTER,PERIOD);
    CUTOFF:=COEF*(VINTER+VINTRA)*C;
    MF:=C-(H+L)/2+Typical()-Ref(Typical(),-1);
    FVE:=Sum(If(MF>CUTOFF, +V, If(MF <-CUTOFF, -V,0)),PERIOD)/
    Mov(V,PERIOD,S)/PERIOD*100;
    X1<21 and X1>2 AND {Condition 1}
    Ref(LinRegSlope(C,13)/Ref(C,-13)*100,-X1)>2.2{Condition 2}
    AND Ref(LinRegSlope(C,X2)/Ref(C,-X2),-1)*100<.2
    AND LinRegSlope(C,X1)/Ref(C,-X1)>-1.2 {Condition 3}
    AND Ref(LinRegSlope(V,X2)/Ref(V,-X2),-1)*100<-2 {Condition 4}
    AND Ref(LinRegSlope(SD,X1),-1)<0 {Condition 5}
    AND Stoch(20,3)>55 AND ADX(10)>30{Condition 6}
    AND FVE>10 AND Fml("VFI")>-3 {Condition 7}
    AND C>Ref(C,-1) AND C>O {Condition 8}
    
    //SELL
    D1:=Simulation.CurrentPositionAge; D2:=LASTVALUE(D1);
    zz:=Zig(Ref(C,-D2),17,%);
    X:=BarsSince(ZZ<Ref(ZZ,-1)AND Ref(ZZ,-1)>Ref(ZZ,-2));
    X1:=LastValue(X)+1; {flag duration}
    c1:=LLV(C,(D2+40)); {pole base}
    c2:=ref(hhv(c,22),-D2); {pole top}
    BREAK1:= Simulation.CurrentPositionPerformance*100;
    POLE:=(C2-C1)/C1*100; {pole height %}
    {EXIT CONDITIONS}
    BREAK1 >1.94* Power(pole ,.724) { Exit condition 1- profit target }
    OR C<REF(LLV(C,X1),-D2) { Exit condition 2 stop loss on breaking
    of lower flag trendline}
    OR (D2>14 AND BREAK1<.25*POLE) { Exit condition 3-inactivity }
    OR (D2>3 AND C<.9*HHV(C,4)) { Exit condition 4-trailing stop loss}
    OR D2>24 { Exit condition 5-time exit}
    
    
    //VFI indicator
    
    PERIOD:= Input("PERIOD FOR VFI ",5,1300,130); 
    COEF:=.2;
    VCOEF:=Input("MAX VOLUME CUTOFF",0,50,2.5);
    INTER:=Log(Typical())-Log(Ref(Typical(),-1));
    VINTER:=Stdev(INTER,30);
    CUTOFF:=COEF*VINTER*C;
    VAVE:=Ref(Mov(V,PERIOD,S),-1);
    VMAX:=VAVE*VCOEF;
    VC:=If(V<VMAX,V,VMAX); 
    MF:=Typical()-Ref(Typical(),-1);
    VFI:=Sum(If(MF>CUTOFF, +VC, If(MF <-CUTOFF, -VC,0)),PERIOD)/VAVE;
    Mov(VFI,3,E);
    
    //FVE indicator
    PERIOD:= Input("PERIOD FOR FVE",5,80,22); 
    COEF:=Input("COEF FOR CUTOFF",0,2,.1);
    INTRA:=Log(H)-Log(L);VINTRA:=Stdev(INTRA,PERIOD);
    INTER:=Log(Typical())-Log(Ref(Typical(),-1));
    VINTER:=Stdev(INTER,PERIOD);
    CUTOFF:=COEF*(VINTER+VINTRA)*C;
    MF:=C-(H+L)/2+Typical()-Ref(Typical(),-1);
    FVE:=Sum(If(MF>CUTOFF, +V, If(MF <-CUTOFF, -V,0)),PERIOD)/Mov(V,PERIOD,S)/PERIOD*100;
    FVE
    

  2. Re: DRAGONPIPS

     

    Hey.. When you say real account do you mean live account number with real dollars involved.. I would never publish my LIVE account number with any of the stat sites... When MT4 sends the publish info to the stat sites it includes the Broker Name and Broker account number.. The stats sites then have your real info.. They also have you internet info.. They just blank it out when displaying the web page.. Dont know about you but they aint gonna get my real numbers.. Demo account who cares..

     

    There is no way to know what these stats sites do with the info they have.. It would be real easy to sell the information to others.. Demo account who cares.. Live account NO WAY..

     

    I would maybe trust mt4live a little bit.. The owner hangs out at TSD.. I have no idea where the owner of mt4stat hangs out.. Be carefull on the net and what info you release..

     

    Thank you for you comment and suggest.

    Yes the mt4stat should know my name and account number but they can not do anything in my account.

  3. Re: DRAGONPIPS

     

    Update result 8-) 8-) 8-) 8-)

     

    1.Fxopen standard account --->>http://save2009.mt4live.com

    setting

    SetYourBalanceTargetBelow=-- Stop if balance target equal or bigger than --
    BalanceTarget=10000000.00000000
    TradingTime=Depending broker, Do not change Trading Time
    OpenHour=22
    CloseHour=2
    Lots=0.10000000
    MaxLots=100.00000000
    lotsOptimizedInfo=-- False if your balance under $1000 standard account with start Lots 0.01--
    LotsOptimized=1
    LotDecimal=1
    Risk=50
    MaxTrades=5
    BrokerSpread=-- Set spread not over than 4 --
    Spread=3.00000000
    ExpertInfo=You can change EA name below to hide EA identity
    ExpertName=DragonPips

     

    2.Fxopen micro account --->>http://microfxtrader.mt4live.com

    setting

    SetYourBalanceTargetBelow=-- Stop if balance target equal or bigger than --
    BalanceTarget=10000000.00000000
    TradingTime=Depending broker, Do not change Trading Time
    OpenHour=22
    CloseHour=2
    Lots=0.10000000
    MaxLots=100.00000000
    lotsOptimizedInfo=-- False if your balance under $1000 standard account with start Lots 0.01--
    LotsOptimized=1
    LotDecimal=1
    Risk=100
    MaxTrades=5
    BrokerSpread=-- Set spread not over than 4 --
    Spread=3.00000000
    ExpertInfo=You can change EA name below to hide EA identity
    ExpertName=DragonPips

     

    3. Alpari-NZ 5 digit --->>>http://5digitfx.mt4live.com

    setting

    SetYourBalanceTargetBelow=-- Stop if balance target equal or bigger than --
    BalanceTarget=10000000.00000000
    TradingTime=Depending broker, Do not change Trading Time
    OpenHour=21
    CloseHour=1
    Lots=0.10000000
    MaxLots=100.00000000
    lotsOptimizedInfo=-- False if your balance under $1000 standard account with start Lots 0.01--
    LotsOptimized=1
    LotDecimal=1
    Risk=50
    MaxTrades=5
    BrokerSpread=-- Set spread not over than 4 --
    Spread=3.00000000
    ExpertInfo=You can change EA name below to hide EA identity
    ExpertName=DragonPips

×
×
  • Create New...