Forum

How to fix Arrayoutof size error

Im trying to convert an indicator in an EA and the arrays are giving me an issue cause mt4 gives an out of size error at one of the arrays double pv[], s1[], r1[], s2[], r2[], s3[], r3[]; then set here Oninit SetIndexBuffer ( 0 , pv); SetIndexBuffer ( 1 , s1); SetIndexBuffer ( 2 , r1);

Issue counting closed trades

I am having an issue trying to count closed trades , i just can seem to get it done . int ClosedOdersCount = 0 ; datetime TimeNow = TimeCurrent (); datetime TimeBefore = TimeCurrent () - 860000 ; long OrderType ; HistorySelect (TimeBefore,TimeNow); if ( HistoryOrdersTotal () > 0 ){ for (

My function stops working once I change the timeframe

I have a simple function that draws a daily open line for that day and then also for that week but once i change the timeframe of the function for monthly it just stops working Heres the daily : void CreateOpenLine( int barsBack) { // Set up necessary variables datetime start_time, end_time;

Making Trend lines that don't start from infinity and continue to infinity

I have a function that creates trend lines from one point in an array to a third point but i cannot stop it from creating lines that start and and end at ininfiy . The trend lines it creates are from an array thats filled by another function , the point of the array filling function is to find

Can't get the right information from copy buffer

Hello there's a custom indicator that I'm loading into iCustom that has 10 buffers in the data window. The buffers I want to get values from are the first and second ones and using copy buffer on "0" and "1" returns me a random string of numbers that is not the value I want, this number doesn't

Close all open positions by profit

hi i made this function to close trades when the amount of profit in the open positions crosses a certain threshold the bot closes all open positions cause i noticed in the back test that EA was had alot of equity it was holding onto but was not closing the trades. bool CloseAll () { bool result =

SL set above the price when buying

I am getting an invalid Stop error when trying out my EA on XAGUSD and BTCEUR , when buying my stoploss is being set to above the buying price and i cant even tell where the issue is in my code : https://pastebin.com/iFQUHDQf heres the entire code in the pastebin

Identifying graphical objects on chart

Hi i have an indicator that gives arrows for buying and selling that I'm trying to turn into an EA, i do not have the source code for the indicator so I'm trying to write code that will identify these arrows on the chart but I'm not sure where to start. I know there's plenty of articles on using