陶飞 发表于 2023-5-30 23:16:00

用ChatGPT尝试编写的EA



有没有尝试过用ChatGPT编写EA,很遗憾,还是需要人工修正。

//+------------------------------------------------------------------+
//|                                  Future BreakdownLevelDay.mq4 |
//|                                 Copyright 2011-2023, Justin Tao|
//|   微信:taofei7456或者 taofei007            @qq.com   |
//+------------------------------------------------------------------+
#property copyright "Copyright 2011-2023, Justin Tao"
#property link      "taofei007@qq.com"
//--------------------------------------------------------------------
extern string TimeSet      = "00:00";//Order place time, if TimeSet = "00:00", the EA works on the breakdown of the previous day.
extern int    Delta      = 6,      //Order price shift (in points) from High/Low price
            SL         = 2000,      //Stop Loss (in points)
            TP         = 2000,       //Take Profit (in points)
            risk         = 0,      //if 0, fixed lot is used
            NoLoss       = 0,      //if 0, it doesn't uses break-even
            trailing   = 0;      //if 0, it doesn't uses trailing
extern double Lot          = 0.10;   //used only if risk = 0
extern bool   OpenStop   = true;   //Place stop orders if order is opened
extern colorcolor_BAR    = DarkBlue; //info color
//--------------------------------------------------------------------
double      MaxPrice,MinPrice;
int         STOPLEVEL,magic=123321,tip,TimeBarbuy,TimeBarSell,LastDay;
//--------------------------------------------------------------------
int init()
{
   STOPLEVEL = MarketInfo(Symbol(),MODE_STOPLEVEL);
   if (SL < STOPLEVEL) SL = STOPLEVEL;
   if (TP < STOPLEVEL) TP = STOPLEVEL;
   if (NoLoss   < STOPLEVEL && NoLoss   != 0) NoLoss   = STOPLEVEL;
   if (trailing < STOPLEVEL && trailing != 0) trailing = STOPLEVEL;
   Comment("Copyright ?2011 cmillion@narod.ru\n BreakdownLevelDay input parameters"+"\n"+
      "TimeSet   "   , TimeSet,         "\n",
      "Delta       " , Delta,             "\n",
      "SL         ", SL,                "\n",
      "TP          " , TP,                "\n",
      "Lot          ", DoubleToStr(Lot,2),"\n",
      "risk         ", risk,            "\n",
      "NoLoss    "   , NoLoss,            "\n",
      "trailing   ", trailing);
   if (TimeSet=="00:00") LastDay=1;
}
具体详见附件

陶飞 发表于 2023-5-30 23:18:43

不错的历史回测,品种SP500

均鸣 发表于 2024-8-8 13:15:39

{:1_189:}

大漠枭雄 发表于 2024-9-26 18:46:45

顶下
页: [1]
查看完整版本: 用ChatGPT尝试编写的EA