請幫助Money Money Management! (免費EA)
Results 1 to 5 of 5

Thread: 請幫助Money Money Management! (免費EA)

  1. #1
    4附件。


    大家好,祝你新年快樂!


    我在這裡發布了我開發的EA代碼。

    我用它製作了它:


    http://sufx.core.t3-ism.net/ExpertAdvisorBuilder/


    正如圖表顯示的是EurUsd,它對於每日圖表設置上的偶爾Scalps非常有效,儘管在2年半期內交易相當少。


    它也適用於其他一些專業,但不是全部。


    我已經測試了TP作為預設,並且還禁用了TP,以便SL翻轉到Trail to Close Trades,只要很少(如果有的話)達到TP Level。


    我已經添加了資金管理,這是事情變得有趣的地方。



    我遇到的問題是,無論我使用輸入設置做什麼,我都無法選擇交易價值低於每1k餘額0.1。有趣的是,上述結果顯示基於$ 1 000初始餘額和交易的結果,起價為每點1美元!


    我的願望是雙重的,第二個不太重要:


    1.讓資金管理允許Microlots。

    2.讓EA與5位數經紀商兼容。

    我說第3個了嗎?

    沒有,但在這個問題上掙扎,Stealth Trailing Stop將是一個非常棒的獎金



    主啊,我現在感到厚顏無恥







    如果有人可以幫助我,我將非常感激並分享EA供其他人使用。




    先感謝您!


    問候,

    大衛(FM)。



    EA代碼:




    // ----------------------------------------------- -------------------
    //|此MQL由Expert Advisor Builder生成
    //|
    http://sufx.core.t3-ism.net/ExpertAdvisorBuilder/|
    //| |
    //|在任何情況下,作者均不對任何損害承擔責任。 |
    //|使用風險由您自己承擔。 |
    //| ***************編制了DAY圖表*************** |
    //| |
    //| ****製作人:**** |
    //| **** David Coulson()**** |
    //| |
    -------------------不要刪除這個標題--------------------



    #define SIGNAL_NONE 0
    #define SIGNAL_BUY 1
    #define SIGNAL_SELL 2
    #define SIGNAL_CLOSEBUY 3
    #define SIGNAL_CLOSESELL 4

    #property copyright Expert Advisor Builder
    #property鏈接http://sufx.core.t3-ism.net/ExpertAdvisorBuilder/

    extern int MagicNumber = 0123490;
    extern bool SignalMail = False;
    extern bool EachTickMode = False;
    extern double Lots = 0.1;
    extern bool UseMM = true;
    extern double LotsPer1000 = 0.1;
    extern int Slippage = 3;
    extern bool UseStopLoss = True;
    extern int StopLoss = 2000;
    extern bool UseTakeProfit = True;
    extern int TakeProfit = 2000;
    extern bool UseTrailingStop = True;
    extern int TrailingStop = 350;


    int BarCount;
    int當前;
    bool TickCheck =假;
    // ----------------------------------------------- -------------------
    //|專家初始化功能|
    // ----------------------------------------------- -------------------
    int init(){
    BarCount =酒吧;

    if(EachTickMode)Current = 0;否則當前= 1;

    返回(0);
    }
    // ----------------------------------------------- -------------------
    //|專家取消初始化功能|
    // ----------------------------------------------- -------------------
    int deinit(){
    返回(0);
    }
    // ----------------------------------------------- -------------------
    //|專家啟動功能|
    // ----------------------------------------------- -------------------
    int start(){
    int Order = SIGNAL_NONE;
    int Total,Ticket;
    double StopLossLevel,TakeProfitLevel;



    if(EachTickMode Bars!= BarCount)TickCheck = False;
    Total = OrdersTotal();
    Order = SIGNAL_NONE;

    // ----------------------------------------------- -------------------
    //|變量開始|
    // ----------------------------------------------- -------------------


    double Buy1_1 = iStochastic(NULL,0,15,8,4,MODE_SMA,0,MODE_MAIN,Current 0);
    double Buy1_2 = 65;
    double Buy2_1 = iStochastic(NULL,0,15,8,4,MODE_SMA,0,MODE_MAIN,Current 1);
    雙買2_2 = 65;
    double Buy3_1 = iStochastic(NULL,0,15,8,4,MODE_SMA,0,MODE_MAIN,Current 2);
    double Buy3_2 = 65;

    double Sell1_1 = iStochastic(NULL,0,15,8,4,MODE_SMA,0,MODE_MAIN,Current 0);
    double Sell1_2 = 35;
    double Sell2_1 = iStochastic(NULL,0,15,8,4,MODE_SMA,0,MODE_MAIN,Current 1);
    double Sell2_2 = 35;
    double Sell3_1 = iStochastic(NULL,0,15,8,4,MODE_SMA,0,MODE_MAIN,Current 2);
    double Sell3_2 = 35;





    // ----------------------------------------------- -------------------
    //|變量結束|
    // ----------------------------------------------- -------------------

    //檢查位置
    bool IsTrade = False;

    for(int i = 0; i lt; Total; i ){
    OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
    if(OrderType()lt; = OP_SELL OrderSymbol()== Symbol()){
    IsTrade = True;
    if(OrderType()== OP_BUY){
    //關

    // ----------------------------------------------- -------------------
    //|信號開始(退出購買)|
    // ----------------------------------------------- -------------------



    // ----------------------------------------------- -------------------
    //|信號結束(退出購買)|
    // ----------------------------------------------- -------------------

    if(Order == SIGNAL_CLOSEBUY((EachTickMode!TickCheck)||(!EachTickMode(Bars!= BarCount)))){
    OrderClose(OrderTicket(),OrderLots(),Bid,Slippage,MediumSeaGreen);
    if(SignalMail)SendMail([Signal Alert],[ Symbol() ] DoubleToStr(Bid,Digits) Close Buy);
    if(!EachTickMode)BarCount = Bars;
    IsTrade = False;
    繼續;
    }
    //追踪止損
    if(UseTrailingStop TrailingStop gt; 0){
    if(Bid - OrderOpenPrice()gt; Point * TrailingStop){
    if(OrderStopLoss()lt; Bid - Point * TrailingStop){
    OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point * TrailingStop,OrderTakeProfit(),0,MediumSeaGreen);
    if(!EachTickMode)BarCount = Bars;
    繼續;
    }
    }
    }
    } else {
    //關

    // ----------------------------------------------- -------------------
    //|信號開始(退出賣出)|
    // ----------------------------------------------- -------------------



    // ----------------------------------------------- -------------------
    //|信號結束(退出賣出)|
    // ----------------------------------------------- -------------------

    if(Order == SIGNAL_CLOSESELL((EachTickMode!TickCheck)||(!EachTickMode(Bars!= BarCount)))){
    OrderClose(OrderTicket(),OrderLots(),Ask,Slippage,DarkOrange);
    if(SignalMail)SendMail([Signal Alert],[ Symbol() ] DoubleToStr(Ask,Digits) Close Sell);
    if(!EachTickMode)BarCount = Bars;
    IsTrade = False;
    繼續;
    }
    //追踪止損
    if(UseTrailingStop TrailingStop gt; 0){
    if((OrderOpenPrice() - Ask)gt;(Point * TrailingStop)){
    if((OrderStopLoss()gt;(Ask Point * TrailingStop))||(OrderStopLoss()== 0)){
    OrderModify(OrderTicket(),OrderOpenPrice(),Ask Point * TrailingStop,OrderTakeProfit(),0,DarkOrange);
    if(!EachTickMode)BarCount = Bars;
    繼續;
    }
    }
    }
    }
    }
    }

    // ----------------------------------------------- -------------------
    //|信號開始(輸入)|
    // ----------------------------------------------- -------------------

    if(Buy1_1 gt; Buy1_2 Buy2_1 lt; Buy2_2 Buy3_1 lt; Buy3_2)Order = SIGNAL_BUY;

    if(Sell1_1 lt; Sell1_2 Sell2_1 gt; Sell2_2 Sell3_1 gt; Sell3_2)Order = SIGNAL_SELL;


    // ----------------------------------------------- -------------------
    //|信號結束|
    // ----------------------------------------------- -------------------

    //購買
    if(Order == SIGNAL_BUY((EachTickMode!TickCheck)||(!EachTickMode(Bars!= BarCount)))){
    if(!IsTrade){
    //檢查可用保證金
    if(AccountFreeMargin()lt;(1 * Lots)){
    打印(我們沒有錢。免費保證金=,AccountFreeMargin());
    返回(0);
    }

    if(UseStopLoss)StopLossLevel = Ask - StopLoss * Point;否則StopLossLevel = 0.0;
    if(UseTakeProfit)TakeProfitLevel = Ask TakeProfit * Point;否則TakeProfitLevel = 0.0;

    Ticket = OrderSend(Symbol(),OP_BUY,CalculateLots(UseMM,LotsPer1000,Lots),Ask,Slippage,StopLossLevel,TakeProfitLevel,Buy(# MagicNumber ),MagicNumber,0,DodgerBlue);
    if(Ticket gt; 0){
    if(OrderSelect(Ticket,SELECT_BY_TICKET,MODE_TRADES)){
    打印(已開啟買入訂單:,OrderOpenPrice());
    if(SignalMail)SendMail([Signal Alert],[ Symbol() ] DoubleToStr(Ask,Digits) Open Buy);
    } else {
    打印(錯誤打開購買訂單:,GetLastError());
    }
    }
    if(EachTickMode)TickCheck = True;
    if(!EachTickMode)BarCount = Bars;
    返回(0);
    }
    }

    //賣
    if(Order == SIGNAL_SELL((EachTickMode!TickCheck)||(!EachTickMode(Bars!= BarCount)))){
    if(!IsTrade){
    //檢查可用保證金
    if(AccountFreeMargin()lt;(1 * Lots)){
    打印(我們沒有錢。免費保證金=,AccountFreeMargin());
    返回(0);
    }

    if(UseStopLoss)StopLossLevel = Bid StopLoss * Point;否則StopLossLevel = 0.0;
    if(UseTakeProfit)TakeProfitLevel = Bid - TakeProfit * Point;否則TakeProfitLevel = 0.0;

    Ticket = OrderSend(Symbol(),OP_SELL,CalculateLots(UseMM,LotsPer1000,Lots),Bid,Slippage,StopLossLevel,TakeProfitLevel,Sell(# MagicNumber ),MagicNumber,0,DeepPink);
    if(Ticket gt; 0){
    if(OrderSelect(Ticket,SELECT_BY_TICKET,MODE_TRADES)){
    打印(賣出訂單:,OrderOpenPrice());
    if(SignalMail)SendMail([Signal Alert],[ Symbol() ] DoubleToStr(Bid,Digits) Open Sell);
    } else {
    打印(錯誤打開賣單:,GetLastError());
    }
    }
    if(EachTickMode)TickCheck = True;
    if(!EachTickMode)BarCount = Bars;
    返回(0);
    }
    }

    if(!EachTickMode)BarCount = Bars;

    返回(0);
    }
    // ----------------------------------------------- -------------------


    #define LOTS_PRECISION 1

    double CalculateLots(bool useMM,double lotsPer1000,double lots)
    {
    if(!useMM)return(lots);

    返回(NormalizeDouble(AccountBalance()/1000 * lotsPer1000,LOTS_PRECISION));

    }












    https://www.forex-pedia.com/crypto-t...te-orders.html

    https://www.forex-pedia.com/crypto-t...dealer-ea.html

    https://www.forex-pedia.com/forex-ma...os-system.html

    https://www.forex-pedia.com/crypto-t...de-copier.html

  2. #2
    我沒有很好地查看代碼,但是使用較小批量的問題可以通過替換插入代碼來解決#define LOTS_PRECISION 1 double CalculateLots(bool useMM,double lotsPer1000,double lots){if(!useMM)返回(很多);返回(NormalizeDouble(AccountBalance()/1000 * lotsPer1000,LOTS_PRECISION));使用Inserted Code double CalculateLots(bool useMM,double lotsPer1000,double lots){if(!useMM)return(lots); double step = MarketInfo(Symbol(),MODE_LOTSTEP); double minlot = MarketInfo(Symbol(),MODE_MINLOT); double lot = MathMax(MathFloor(AccountBalance()/1000 * LotsPer1000step)* step,minlot);返回(批號); }

  3. #3

    Quote Originally Posted by ;
    。大家好,祝你新年快樂!我在這裡發布了我開發的EA代碼。我用它製作了它:
    http://sufx.core.t3-ism.net/ExpertAdvisorBuilder/
    更糟糕的代碼。 。 。讀一讀:
    http://forum.mql4.com/48594然後閱讀並實施:
    http://forum.mql4.com/48352
    http://forum.mql4.com/48276

  4. #4

    Quote Originally Posted by ;
    我沒有很好地查看代碼,但是使用較小批量的問題可以通過替換#define LOTS_PRECISION 1 double CalculateLots(bool useMM,double lotsPer1000,double lots){if(!useMM)return(手);返回(NormalizeDouble(AccountBalance()/1000 * lotsPer1000,LOTS_PRECISION));用double CalculateLots(bool useMM,double lotsPer1000,double lots){if(!useMM)return(lots); double step = MarketInfo(Symbol(),MODE_LOTSTEP); double minlot = MarketInfo(Symbol(),MODE_MINLOT); double lot = MathMax(MathFloor(AccountBalance()/1000 * LotsPer1000step)* step,minlot); ...
    謝謝Gumrai~我稍後會試試,讓你知道

  5. #5

    Quote Originally Posted by ;
    {quote}更糟糕的代碼。 。 。讀一讀:
    http://forum.mql4.com/48594然後閱讀並實施:
    http://forum.mql4.com/48352
    http://forum.mql4.com/48276
    謝謝Raptor,我在MQL網站上閱讀了很多你的帖子。您的建議表示讚賞

發布權限

  • 您不可發布新主題
  • 您不可回复
  • 您不可發布附件
  • 您不可編輯您的帖子
  •  
  • BB代碼是打開的
  • 表情符號是打開的
  • [IMG]代碼是打開的
  • [視頻]代碼是打開的
  • HTML代碼是關閉的
forex-pedia網站使用cookie 文字跟蹤
forex-pedia.com網站使用cookie 文字跟蹤,某些設定已經固定。您可以點擊此處閱讀我們的Cookie使用說明。 請點擊右鍵接受我們的cookies。如果您選擇繼續使用forex-pedia.com網站,我們將認為您接受我們的cookies。