请帮助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.histoforex.com/crypto-tr...te-orders.html

    https://www.histoforex.com/crypto-tr...dealer-ea.html

    https://www.histoforex.com/forex-mar...os-system.html

    https://www.histoforex.com/crypto-tr...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代码是关闭的
histoforex网站使用cookie 文字跟踪
histoforex网站使用cookie 文字跟踪,某些设定已经固定。您可以点击此处阅读我们的Cookie使用说明。 请点击右键接受我们的cookies。如果您选择继续使用histoforex网站,我们将认为您接受我们的cookies。