找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
首页论坛EAHub 外汇论坛
查看: 7|回复: 0

哪位大大哥能帮小弟无币修改这款下单EA的小缺陷

[复制链接]

4万

主题

54

回帖

4万

积分

管理员

积分
45954
发表于 2026-8-20 12:12:00 | 显示全部楼层 |阅读模式
最后由 Investwise 于 2021-9-13 10:43 编辑

这是一款免费无限制的简单下单EA,但就缺了更改EA左右上下位置的设定。

希望社区大大哥能好心帮小弟无币修改,好人一生平安。谢谢。






EA 源码:

//+------------------------------------------------------------------------------------------------------------------+

#property description                                                                                   "[FX-TRADE-g]"

#define Version                                                                                         "[FX-TRADE-g]"

//+------------------------------------------------------------------------------------------------------------------+

#property link        "https://forex-station.com/viewtopic.php?p=1294848283#p1294848283"

#property description "THIS IS A FREE INDICATOR"

#property description "                                                      "

#property description "Welcome to the World of Forex"

#property description "Let light shine out of darkness and illuminate your world"

#property description "and with this freedom leave behind your cave of denial"

//+------------------------------------------------------------------------------------------------------------------+

#include <stdlib.mqh>

#include <WinUser32.mqh>

         bool RiskMM=true; int slippage=5,ticket1; string display="",SymbolPair="";

       double MinLots=0.10,MaxLots=10000,LotsTraded=2000,stopsize1=0,profsize1=0,Lots,stop1,prof1;

extern double LOTSIZE=0.01; double PIPLOSS=0.;

          int Move_X = 0,Move_Y = 40;   int Corner = 1;

          int Button_Width = 100,Font_Size = 10,Font_Size2 = 71;

       string Font_Type = "Arial Bold";

       string Font_Type2= "Webdings";

        color Font_Color = White;

//+------------------------------------------------------------------------------------------------------------------+

         bool showINFOBOX                = false; const string ID="FX PANEL 2";

extern color clrPanel                   = C'91,103,112';//C'34,34,34';  

        color PanelBorderColor           = clrSnow,Boxbgd=C'30,40,50';

          int PanelBorderWidth           = 1,InfoBoxCorner=1,Window=0; int posLR=6,posUD=-120;

//+------------------------------------------------------------------------------------------------------------------+

   int OnInit(){ CreateButtons(); CleanUpIsle1();

   ToolTips_Text ("Lot_00000_btn");

   ToolTips_Text ("Buy_00000_btn");

   ToolTips_Text ("Sell_0000_btn");

   ToolTips_Text ("Close_All_btn");

   ToolTips_Text ("anic_000_btn");

    ObjectCreate ("Lot_Edit", OBJ_EDIT, ChartWindowFind(), 0, 0);

       ObjectSet ("Lot_Edit", OBJPROP_CORNER, 1);

       ObjectSet ("Lot_Edit", OBJPROP_XSIZE, Button_Width - 040);

       ObjectSet ("Lot_Edit", OBJPROP_YSIZE, Font_Size*2.);

       ObjectSet ("Lot_Edit", OBJPROP_XDISTANCE, 085+Move_X);

       ObjectSet ("Lot_Edit", OBJPROP_YDISTANCE, 278+Move_Y);

   ObjectSetText ("Lot_Edit", LOTSIZE , 14, Font_Type, Font_Color);  return(INIT_SUCCEEDED);}

//+------------------------------------------------------------------------------------------------------------------+

   void OnDeinit(const int reason){DeleteButtons(); CleanUpIsle1(); ObjectDelete ("Lot_Edit");}

//+------------------------------------------------------------------------------------------------------------------+

   void OnChartEvent (const int id, const long &lparam, const double &dparam, const string &sparam){ResetLastError();

   if(id == CHARTEVENT_OBJECT_CLICK) {if (ObjectType (sparam) == OBJ_BUTTON) {ButtonPressed (0, sparam);}}}

//+------------------------------------------------------------------------------------------------------------------+

   void CreateButtons(){ int Button_Height = Font_Size*2.8;

   if(!ButtonCreate (0,"Lot_00000_btn",0,102,250,Button_Width-10,Button_Height,Corner,"LotSize",Font_Type,Font_Size+6,Font_Color,clrPanel,clrPanel)) return;

   if(!ButtonCreate (0,"Buy_00000_btn",0,099,305,Button_Width-60,Button_Height,Corner,"BUY",Font_Type,Font_Size+1,Snow,Green,Snow)) return;

   if(!ButtonCreate (0,"Sell_0000_btn",0,054,305,Button_Width-60,Button_Height,Corner,"SELL",Font_Type,Font_Size+1,Snow,Crimson,Snow)) return;

   if(!ButtonCreate (0,"Close_All_btn",0,096,340,Button_Width-21,Button_Height,Corner,"CLOSE",Font_Type,Font_Size+3,Font_Color,Blue,Snow)) return;

   if(!ButtonCreate (0,"anic_000_btn",0,100,375,Button_Width-14,Button_Height,Corner,"CLOSEALL",Font_Type,Font_Size+1,Font_Color,Crimson,Snow)) return;

   ChartRedraw();}

//+------------------------------------------------------------------------------------------------------------------+

   void DeleteButtons(){

     ButtonDelete (0, "Buy_00000_btn");

     ButtonDelete (0, "Sell_0000_btn");

     ButtonDelete (0, "Close_All_btn");

     ButtonDelete (0, "Lot_00000_btn");

     ButtonDelete (0, "anic_000_btn");}

//+------------------------------------------------------------------------------------------------------------------+

   void ButtonPressed (const long chartID, const string sparam){

     if (sparam == "Buy_00000_btn") Buy_00000_Button (sparam);

     if (sparam == "Sell_0000_btn") Sell_0000_Button (sparam);

     if (sparam == "Close_All_btn") Close_All_Button (sparam);

     if (sparam == "anic_000_btn") Panic_000_Button (sparam);

     if (sparam == "Lot_00000_btn") Lot_00000_Button (sparam);  Sleep (10);}

//+------------------------------------------------------------------------------------------------------------------+

   void ToolTips_Text(const string sparam){

   if (sparam == "Lot_00000_btn") {ObjectSetString (0, sparam, OBJPROP_TOOLTIP, "Lot To Be Used");}

   if (sparam == "Buy_00000_btn") {ObjectSetString (0, sparam, OBJPROP_TOOLTIP, "Open BUY Order");}

   if (sparam == "Sell_0000_btn") {ObjectSetString (0, sparam, OBJPROP_TOOLTIP, "Open SELL Order");}

   if (sparam == "anic_000_btn") {ObjectSetString (0, sparam, OBJPROP_TOOLTIP, "For When The SHTF");}

   if (sparam == "Close_All_btn") {ObjectSetString (0, sparam, OBJPROP_TOOLTIP, "Close All Open Orders on Chart");}}

//+------------------------------------------------------------------------------------------------------------------+

   int Lot_00000_Button (const string sparam){return(0);}

//+------------------------------------------------------------------------------------------------------------------+

   int Close_All_Button (const string sparam){int ticket;

   if (OrdersTotal() == 0) return(0);

   for (int i = OrdersTotal() - 1; i >= 0; i--){

   if (OrderSelect (i, SELECT_BY_POS, MODE_TRADES) == true){

   if (OrderType() == 0 && OrderSymbol() == Symbol()){

       ticket = OrderClose (OrderTicket(), OrderLots(), Bid, 3, CLR_NONE);

   if (ticket == -1) Print ("Error: ", GetLastError());

   if (ticket >   0) Print ("osition ", OrderTicket() ," closed");}

   if (OrderType() == 1 && OrderSymbol() == Symbol()){

       ticket = OrderClose (OrderTicket(), OrderLots(), Ask, 3, CLR_NONE);

   if (ticket == -1) Print ("Error: ",  GetLastError());

   if (ticket >   0) Print ("osition ", OrderTicket() ," closed");}}}  return(0);}

//+------------------------------------------------------------------------------------------------------------------+

   int Panic_000_Button (const string sparam){

   if (OrdersTotal() == 0) return(0);

   for (int i=OrdersTotal()-1; i>=0; i--){

   if (OrderSelect (i, SELECT_BY_POS, MODE_TRADES) == true){

   if(OrderType()==OP_BUY ) OrderClose(OrderTicket(),OrderLots(),Bid,5,Violet);

   if(OrderType()==OP_SELL) OrderClose(OrderTicket(),OrderLots(),Ask,5,Violet);

   if(OrderType()> OP_SELL) OrderDelete(OrderTicket()); }} return(0);}

//+------------------------------------------------------------------------------------------------------------------+

   int Buy_00000_Button (const string sparam){

   double Lot_Extract = StrToDouble (ObjectGetString (0, "Lot_Edit", OBJPROP_TEXT, 0));

   OrderSend(Symbol(),OP_BUY,Lot_Extract,Ask,slippage,0,0, "BUY", 12345601, 0, CLR_NONE);  return(0);}

//+------------------------------------------------------------------------------------------------------------------+

   int Sell_0000_Button (const string sparam){

   double Lot_Extract = StrToDouble (ObjectGetString (0, "Lot_Edit", OBJPROP_TEXT, 0));

   OrderSend (Symbol(),OP_SELL,Lot_Extract,Bid,slippage,0,0, "SELL", 12345602, 0, CLR_NONE);  return(0);}

//+------------------------------------------------------------------------------------------------------------------+

   bool ButtonCreate (const string chart_ID="FX PANEL 2", const string name="Button", const int sub_window=0, const int x=0, const int y=0, const int width=500,

                      const int height=18, int corner=1, const string text="Button", const string font="Arial Bold",

                      const int font_size=10, const color clr=clrBlack, const color back_clr=C'170,170,170', const color border_clr=clrNONE,

                      const bool state=false, const bool back=false, const bool selection=false, const bool hidden=true, const long z_order=0){

   ResetLastError();

   if (!ObjectCreate (chart_ID,name, OBJ_BUTTON, 0, 0, 0)){

      Print (__FUNCTION__, ": failed to create the button! Error code = ", GetLastError());  return(false);}

   ObjectSetInteger (chart_ID, name, OBJPROP_XDISTANCE, x);

   ObjectSetInteger (chart_ID, name, OBJPROP_YDISTANCE, y+40);

   ObjectSetInteger (chart_ID, name, OBJPROP_XSIZE, width);

   ObjectSetInteger (chart_ID, name, OBJPROP_YSIZE, height);

   ObjectSetInteger (chart_ID, name, OBJPROP_CORNER, corner);

   ObjectSetInteger (chart_ID, name, OBJPROP_FONTSIZE, font_size);

   ObjectSetInteger (chart_ID, name, OBJPROP_COLOR, clr);

   ObjectSetInteger (chart_ID, name, OBJPROP_BGCOLOR, back_clr);

   ObjectSetInteger (chart_ID, name, OBJPROP_BORDER_COLOR, border_clr);

   ObjectSetInteger (chart_ID, name, OBJPROP_BACK, back);

   ObjectSetInteger (chart_ID, name, OBJPROP_STATE, state);

   ObjectSetInteger (chart_ID, name, OBJPROP_SELECTABLE, selection);

   ObjectSetInteger (chart_ID, name, OBJPROP_SELECTED, selection);

   ObjectSetInteger (chart_ID, name, OBJPROP_HIDDEN, hidden);

   ObjectSetInteger (chart_ID, name, OBJPROP_ZORDER,z_order);

   ObjectSetString  (chart_ID, name, OBJPROP_TEXT, text);

   ObjectSetString  (chart_ID, name, OBJPROP_FONT, font);

   return(true);}

//+------------------------------------------------------------------------------------------------------------------+

   bool ButtonDelete (const long chart_ID=0, const string name="Button"){ ResetLastError();

   if (!ObjectDelete (chart_ID,name)){

      Print (__FUNCTION__, ": Failed to delete the button! Error code = ", GetLastError());  return(false);}

   return(true);}

//+----Clean Chart Function------------------------------------------------------------------------------------------+

   void CleanUpIsle1(){string name; for(int s=ObjectsTotal()-1; s>=0; s--){name=ObjectName(s);

   if(StringSubstr(name,0,StringLen(ID))==ID) {ObjectDelete(name);}}}

//+------------------------------------------------------------------------------------------------------------------+

   double CalculateMM(){MinLots=MarketInfo(Symbol(),MODE_MINLOT); MaxLots=MarketInfo(Symbol(),MODE_MAXLOT);

   Lots=AccountBalance()/LotsTraded; Lots=MathMin(MaxLots,MathMax(MinLots,Lots));

   if(MinLots<0.1)Lots=NormalizeDouble(Lots,3); else {if(MinLots<1)Lots=NormalizeDouble(Lots,1);

   else Lots=NormalizeDouble(Lots,0);} if(Lots<MinLots)Lots=MinLots; if(Lots>MaxLots)Lots=MaxLots;  return(0);}

//+----END OF FILE---------------------------------------------------------------------------------------------------+
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|EAHub外汇论坛

GMT+8, 2026-10-10 16:15 , Processed in 0.102736 second(s), 19 queries .

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表