Expert Advisors and Automated Trading - page 33

Hey guys, I'm quite new to MQL5 so this might be a noob question. When I get my entry signal I want to open 4 positions, each with the same Stop loss but but different Take profits. So I guess my question is how to I open 4 positions and how do I set each position with its own take profit level? I'm
I'm trying to get the upper and lower values from iBand... void OnTick () { double upperBand[]; double lowerBand[]; double range; int handle = iBands ( _Symbol , _Period , 20 , 2 , 0 , PRICE_CLOSE ); // CopyBuffer(handle, which band, period, no. values, where to store)
I'm talking about const members of simple types that are not static (and are not pointers). class CFoo { private : const int i; public : CFoo() { i = 1 ; // 'i' - constant cannot be modified } }; Why is it possible to make members of simple types const? Such a member will not
Please i work in Python and this error appears Can anyone solve this error as this image shows hello all please can any one help me for tis error appear when run simple code in python script in metatreder 5 (2023.11.23 16:19:14.975 Python 'c2': python process thread create error [The system cannot
I want to run OnTick on history in different symbols one after the other Each time the balance must be reset Is it possible to do it via code
Good morning How are you ? I'm looking at the terminal log to debug some of my code for data synchronization between the server and the terminal. Here it is IM 0 09 : 57 : 10.990 (GOLD,M1) History check for GOLD for timeframe M1 FF 0 09 : 57 : 10.990 (GOLD,M1)
Can a function be accessible only to an include file
Good day I want a script to enlarge a chart to the maximum size That is: When Expert mode occurs on the chart, the chart is enlarged to its maximum size automatically Thank you all
New to mql language I'm getting: 'iclose' - cannot convert enum' error on this line of code: h = iHigh(_Symbol, _Period, iHighest(_Symbol, _Period, iClose(_Symbol, smoothTimeframe, 0), trendPeriod, 0));(Symbol(), PERIOD_M1, 0) any help appreciated
Hi all, When running a single simulation in the Strategy Tester with the "visual mode with the display of charts, indicators and trades" checked ON (Settings tab), I get a new separate window with the full simulation. That is what I want. However, I also get another (undesired) chart in the terminal
I'm having issues validating an update to an EA, and I can't figure out what I'm doing wrong. The problem is with the trailing stop, and even though I validate the SYMBOL_TRADE_FREEZE_LEVEL and SYMBOL_TRADE_STOPS_LEVEL, I still get the error "[Modification failed due to order or position being close
So I transferred my VPS to another brokerage account. Then I transferred it back to the original one I had it on. All of the sudden, migration keeps failing. I looked for answers here, and one of the suggestions was to try connecting to another server and restarting my terminal. So I did that. It
Hi together, I (think I) read alot about how to calculate profits and loss of open tickets/deals. In some MQL4/5 talks there so many different opinions and guesses. Im really confused now what is the way or the best way to calculate PnL for the open tickets/deals. The last thing I read that should
I'm getting the below 2 warnings when I compile my expert advisor. Can someone please point me in the right direction to get the 2 functions working implicit conversion from 'number' to 'string' TrendBotV2.mq5 68 27 implicit conversion from 'number' to 'string' TrendBotV2.mq5 116 25
Hi, I want to change code below to a template so that I can used it on enum data type, bool GetIniKey( string fileName, string section, string key, int &ReturnedValue) { string result=GetRawIniString(fileName,section,key); if ( StringLen (result)> 0 ) { ReturnedValue=( int )
I am building an EA and am experiencing some very odd behaviour in the MQL5 compiler, debugger and strategy tester. When I run my code in the debugger, or compile with No Optimisation, it works correctly and as expected. However, when I compile with optimisation enabled it runs very strangely and
hi, i've been working on an EA that has pending orders but it seems like i'm missing something, there are no errors or warnings and i don't know what is wrong; i have never worked with pending orders before and i think its a simple fix that i cant find; even though i looked at free open codes i
I'm not sure if MQL know their Socket TLS functions aren't suitable for Websocket , i've been spending all time of my every last 5 days searching this forum, that forum and all forum on how to make WSS Websocket work all to no avail. Should one just go to WinAPI for every little function
1) One of my input variables is SimTimeFrame (input ENUM_TIMEFRAMES SimTimeFrame ); 2) In the tab "Settings" I set the time frame to "M1", and set Modeling to "Every tick based on real ticks" 3) I run the optimization with "Custom max." 4) In the tab " Optimization Results " I select one of the
Using the const specifier I can protect an array of objects from being resized: class Foo { }; void resizeObjects( const Foo &arr[]) { ArrayResize (arr, 1 ); // 'arr' - constant variable cannot be passed as reference } Why doesn't this work for an array of pointers? class Foo { };
I'll be putting my EA on several pairs at the same time which is something I'm doing for the first time. Usually with one pair its quite easy to manage using a check for PositionsTotal () Now I want to make sure that not more than one trade is taken per pair when trading with multiple pairs. How can
Hello Everyone, I've encountered a strange issue with an indicator while developing my EA. When applying the custom indicator to the chart manually it works fine but when doing it programatically, the two plots of the indicator are inverted. I use several custom indicators in my EA attching them to
void CheckOrder() { BuyNum= 0 ; ArraySetAsSeries (BuyOPrice, true ); ArraySetAsSeries (buy_ticketnum, true ); if ( PositionsTotal ()> 0 ) { for ( int i= 0 ;i<=BuyNum;i++) { ulong takeOrder= PositionGetTicket (i); if ( PositionSelect ( Symbol ())== true ) { if ( PositionGetSymbol
Hi, A quick question on how to remove an array and revert it's size to 0. To do so I use ArrayRemove and the ArrayFree function. Is this correct? ArrayRemove (SymbolArray, 0 , WHOLE_ARRAY ); ArrayFree (SymbolArray);
  back test on MT5 ?  (11   1 2)
Hi I want to work back test 99% accurately on MT5 platform. But I don't know if it's enough to do it directly on MT5 platform? Or should we use other programs like (Tickstory). I mean, Can we believe 99% accuracy results when doing back test directly on the platform or should we use other programs
Hi I create a line object OBJ_HLINE and then I create a label object OBJ_LABEL to put just below it, I can retrieve the line's y coordinates, but how do I display the label completely on the right because a line can't see x-coordinates? thank you in advance for your insights
In MQL4 for closing price you would use the function OrderClosePrice(), I want to use the same function in MQL5. Is this the correct function POSITION_PRICE_CURRENT
Hello Everyone, EA still working on my chart even due i deleted it already !! Can you give me an advice how to solve this issue? Thank you, Ner
Hi All, Was looking to get some help with a GetLotSize function please? The attached code correctly gives a dynamic lot size on every pair apart form USDJPY and I'm racking my brains to see what's wrong with it. I've included the helper function below I think the problem is in the moneyLotStep
Hi, I'm getting different behaviour in MT5 when I translate the following code: MT4: int recentLow = iLowest ( Symbol (), PERIOD_CURRENT , MODE_LOW , 5 , 0 ); double stopLossPrice = Low[recentLow]-( iATR ( Symbol (), PERIOD_CURRENT , 14 , 0 )/ 2 ); MT5: int recentLow = iLowest ( Symbol ()