- Looking for something to secure trades when they've reached a daily level.
- Automatic move to break even only works on buy trades.
- Please fix this indicator or EA
If you need help, then show your code where you attempt to achieve what you want. Describe in detail exactly the steps you are having difficulty with.
If you need help, then show your code where you attempt to achieve what you want. Describe in detail exactly the steps you are having difficulty with.
Sorry, I was definitely running on fumes and frustration last night and it wouldn't allow me to upload more than a certain number of characters so I gave up ^^' Unfortunately I can't find a way to upload it... I will keep attempting to keep pull EA's apart and see if I can find a solution. Thank you for taking the time to reply to my post :)
You are not making sense. There is no character limit on posts (at least that I have ever reached).
When posting code, use the "</>" icon or Alt-S. You can also attach the file itself instead by clicking on "+ Attach file" at the bottom left of the input field for the post, and then selecting your "*.mq?" file.
- Remember (in persistent storage,) your initial risk and do it. You haven't stated a problem, you stated a want. Show us your attempt (using the CODE button) and state the nature of your difficulty.
No free help (2017) -
EAs must be coded to recover. If the power fails, OS crashes, terminal or chart is accidentally closed, on the next tick, any static/global ticket variables will have been lost. You will have an open order but don't know it, so the EA will never try to close it, trail SL, etc. How are you going to recover?
Use a OrderSelect / Position select loop on the first tick, or persistent storage (GV+flush or files) of ticket numbers required.
You are not making sense. There is no character limit on posts (at least that I have ever reached).
When posting code, use the "</>" icon or Alt-S. You can also attach the file itself instead by clicking on "+ Attach file" at the bottom left of the input field for the post, and then selecting your "*.mq?" file.
Thank you, I have updated the post with the file. It's my third rewrite today and I know it's probably horrific, so please be kind :') I've tried many variations, so any guidance would be appreciated. Thank you again!
- Remember (in persistent storage,) your initial risk and do it. You haven't stated a problem, you stated a want. Show us your attempt (using the CODE button) and state the nature of your difficulty.
No free help (2017) -
EAs must be coded to recover. If the power fails, OS crashes, terminal or chart is accidentally closed, on the next tick, any static/global ticket variables will have been lost. You will have an open order but don't know it, so the EA will never try to close it, trail SL, etc. How are you going to recover?
Use a OrderSelect / Position select loop on the first tick, or persistent storage (GV+flush or files) of ticket numbers required.
Yes, thank you, as I mentioned I was having problems uploading my code but someone has helpfully pointed me in the right direction :)
I hadn't thought this far ahead if I'm honest! Haha, but thank you, valid points and something to fine tune once I have the skeleton of my EA up and running :)
Mmm, yes I've tried single function loops and multiple functions that flow into one another, but I'm clearly not understanding something... I know it's frustrating dealing with novices like me, but I really am trying to better myself and learn so please be kind :)
Thank you so much for your reply!
What is this BS? Simplify switch(TradeFilter()) { case 1: OpenTrade(1); break; case 2: OpenTrade(2); break; case 3: OpenTrade(3); break; case 4: OpenTrade(4); break; case 5: OpenTrade(5); break; ⋮ case 29: OpenTrade(29); break; case 30: OpenTrade(30); break; case 31: OpenTrade(31); break; case 32: OpenTrade(32); break; default: break; }
OpenTrade(TradeFilter());
-
if (OrdersTotal()==0) //If total number of orders open is 0, return 0 (do nothing) { return; }
Magic number only allows an EA to identify its trades from all others. Using OrdersTotal/OrdersHistoryTotal (MT4) or PositionsTotal (MT5), directly and/or no Magic number/symbol filtering on your OrderSelect / Position select loop means your code is incompatible with every EA (including itself on other charts and manual trading.)
Symbol Doesn't equal Ordersymbol when another currency is added to another seperate chart . - MQL4 programming forum (2013)
PositionClose is not working - MQL5 programming forum (2020)
MagicNumber: "Magic" Identifier of the Order - MQL4 Articles (2006)
Orders, Positions and Deals in MetaTrader 5 - MQL5 Articles (2011)
Limit one open buy/sell position at a time - General - MQL5 programming forum (2022)You need one Magic Number for each symbol/timeframe/strategy. Trade current timeframe, one strategy, and filter by symbol requires one MN.
-
} else if (number == 2) { orderType = ORDER_TYPE_BUY;
There is no such type in MT4.
-
bool FilterOrders = true; ⋮ if (FilterOrders == true) FilterOrders(GuestTicket, GuestFib61BUY, GuestFib61SELL, GuestFib261BUY, GuestFib261SELL, GuestOrderOpenPrice);
Do not name variables and functions the same.
-
if(OrderModify(ResForTicket,ResForOrderOpenPrice,ResForNewSL, OrderTakeProfit(),0,Plum))
You can not modify the open price once the order opens. No where do you check.
- Violet Cross #: Rewritten again, still no dice :')
Use the debugger or print out your variables, including _LastError and prices and find out why. Do you really expect us to debug your code for you?
Code debugging - Developing programs - MetaEditor Help
Error Handling and Logging in MQL5 - MQL5 Articles (2015)
Tracing, Debugging and Structural Analysis of Source Code - MQL5 Articles (2011)
Introduction to MQL5: How to write simple Expert Advisor and Custom Indicator - MQL5 Articles (2010)
What is this BS? Simplify -
Magic number only allows an EA to identify its trades from all others. Using OrdersTotal/OrdersHistoryTotal (MT4) or PositionsTotal (MT5), directly and/or no Magic number/symbol filtering on your OrderSelect / Position select loop means your code is incompatible with every EA (including itself on other charts and manual trading.)
Symbol Doesn't equal Ordersymbol when another currency is added to another seperate chart . - MQL4 programming forum (2013)
PositionClose is not working - MQL5 programming forum (2020)
MagicNumber: "Magic" Identifier of the Order - MQL4 Articles (2006)
Orders, Positions and Deals in MetaTrader 5 - MQL5 Articles (2011)
Limit one open buy/sell position at a time - General - MQL5 programming forum (2022)You need one Magic Number for each symbol/timeframe/strategy. Trade current timeframe, one strategy, and filter by symbol requires one MN.
-
There is no such type in MT4.
-
Do not name variables and functions the same.
-
You can not modify the open price once the order opens. No where do you check.
-
Use the debugger or print out your variables, including _LastError and prices and find out why. Do you really expect us to debug your code for you?
Code debugging - Developing programs - MetaEditor Help
Error Handling and Logging in MQL5 - MQL5 Articles (2015)
Tracing, Debugging and Structural Analysis of Source Code - MQL5 Articles (2011)
Introduction to MQL5: How to write simple Expert Advisor and Custom Indicator - MQL5 Articles (2010)

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use