hi there, im not well versed in coding so i used chatgpt to help me code this. im down to 1 error and 1 warning. everytime i ask to fix the error after i compile them gives the same error
this is the error
cannot convert 0 to enum 'ENUM_TRADE_REQUEST_ACTIONS' Buy with SL and TP.mq5 67 40
implicit enum conversion Buy with SL and TP.mq5 71 28
and this is generated the script,
//+------------------------------------------------------------------+ //| Buy Sell with SL and TP | //| Copyright © 2024, | //| | //+------------------------------------------------------------------+ #property script_show_inputs extern int NumberOfOrders; extern bool UseActualSlTp; extern double StopLossPrice; extern double TakeProfitPrice; extern string Note; extern double Entry; extern bool MicroOrdersAllowed; extern bool MiniOrdersAllowed; extern bool UseMoneyMgmt; extern double RiskPercent; extern double Lots; extern double StopLoss; extern double TakeProfit; extern string Comments; //+------------------------------------------------------------------+ //| Script program start function | //+------------------------------------------------------------------+ void OnStart() { double Risk = RiskPercent / 100; int OrdersizeAllowed = 0; int Mode = ORDER_TYPE_BUY_STOP; if (SymbolInfoDouble(_Symbol, SYMBOL_ASK) > Entry && Entry > 0) Mode = ORDER_TYPE_BUY_LIMIT; if (Entry == 0) { Entry = SymbolInfoDouble(_Symbol, SYMBOL_ASK); Mode = ORDER_TYPE_BUY; } double SLB = Entry - StopLoss * _Point; double TPB = Entry + TakeProfit * _Point; if (UseActualSlTp) { StopLoss = (Entry - StopLossPrice) / _Point; SLB = StopLossPrice; TPB = TakeProfitPrice; } if (MiniOrdersAllowed) OrdersizeAllowed = 1; if (MicroOrdersAllowed) OrdersizeAllowed = 2; if (UseMoneyMgmt) Lots = NormalizeDouble(AccountInfoDouble(ACCOUNT_BALANCE) * Risk / StopLoss / (SymbolInfoDouble(_Symbol, SYMBOL_TRADE_TICK_VALUE)), OrdersizeAllowed); if ((Lots < 0.01 && MicroOrdersAllowed) || (Lots < 0.1 && MiniOrdersAllowed && !MicroOrdersAllowed)) { Print("YOUR LOTS SIZE IS TOO SMALL TO PLACE!"); } if (Lots > 0) { for (int i = 0; i < NumberOfOrders; i++) { MqlTradeRequest request = {0}; MqlTradeResult result = {0}; request.symbol = _Symbol; request.type = Mode; request.volume = Lots; request.price = Entry; request.sl = SLB; request.tp = TPB; request.comment = Comments; request.action = TRADE_ACTION_DEAL; // Buy action if (OrderSend(request, result)) { Print("Order placed successfully!"); } else { Print("Failed to place order! Error code:", GetLastError()); } } } }
hi there, im not well versed in coding so i used chatgpt to help me code this
Chatgpt generates absolute nonsense on MQL. Therefore, programmers will not even look at your generated code. Not because the programmers are bad, but because the chatgpt generates absolute nonsense.
Either learn programming or write a technical specification and hire a programmer.
Chatgpt generates absolute nonsense on MQL. Therefore, programmers will not even look at your generated code. Not because the programmers are bad, but because the chatgpt generates absolute nonsense.
Either learn programming or write a technical specification and hire a programmer.
Stop using ChatGPT.
Help needed to debug and fix an AI EA - Trading Systems - MQL5 programming forum #2 (2023)
ChatGPT (the worst), “Bots Builder”, “EA builder”, “EA Builder Pro”, EATree, “Etasoft forex generator”, “Forex Strategy Builder”, ForexEAdvisor (aka. ForexEAdvisor STRATEGY BUILDER, and Online Forex Expert Advisor Generator), ForexRobotAcademy.com, forexsb, “FX EA Builder”, fxDreema, Forex Generator, FxPro, “LP-MOBI”, Molanis, “Octa-FX Meta Editor”, Strategy Builder FX, “Strategy Quant”, “Visual Trader Studio”, “MQL5 Wizard”, etc., are all the same. You will get something quick, but then you will spend a much longer time trying to get it right, than if you learned the language up front, and then just wrote it.
Since you haven't learned MQL4/5, therefor there is no common language for us to communicate. If we tell you what you need, you can't code it. If we give you the code, you don't know how to integrate it into yours.
We are willing to HELP you when you post your attempt (using Code button) and state the nature of your problem, but we are not going to debug your hundreds of lines of code. You are essentially going to be on your own.
ChatGPT |
|
bot builder | Creating two OnInit() functions. * |
EA builder | |
EATree | Uses objects on chart to save values — not persistent storage (files or GV+Flush.) No recovery (crash/power failure.) |
ForexEAdvisor |
|
FX EA Builder |
|
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Any body know the code for this strategy
When I Click The EA the following steps i want its possible?
Step 1 : Buy Order TP-20 pips SL-24 Pips
Step 2 : Sell Order TP-20 pips SL-24 Pips
Step 3 : Pending Order Sell Stop Price (First Step Buy Order SL) with TP-30 Pips SL-24 Pips
Step 4 : Pending Order Buy Stop Price (First Step Sell Order SL) with TP-30 Pips SL-24 Pips
Thank You