Forum

Unexpected Calculation Results

Hi I am getting some unexpected results with what i expected to be a simple function. I am trying to check if a value is above a set percentage but am getting unexpected results at the percentage calculation bool isUpTrend( double &MAData[], MqlRates &IUTRates[], int percentRequired, int

Cant allocate array values

Please could someone help me understand whats wrong with the logic in the code attached? It causes an array out of range error at the line: outLFHighArray[SFH]=lastHigh; What im hoping to try and achieve is to be able to create a new array for the last Fractal Value. An array where

Strategy Tester Insufficient Funds

Hi I have been testing my ea with an automatic lot sizing code without problems on mt5. I removed mt5 from my pc and reinstalled it, since then i have been getting errors saying that the account funds are insufficient when the ea tries to place trades. My calculations dont use OrderCalclMargin, i

Stop Loss/ Take Profit errors

Hi I was wondering if someone could clarify what happens if a trade moves through a stop loss/take profit level but doesn't have the liquidity to execute the SL/TP Is this even possible with market orders on fok filling type? Does the trade then continue on until a further command is sent or will it

CopyRates/Copybuffer error checks

void OnStart () { //--- MqlRates rates[]; ArraySetAsSeries (rates, true ); int copied= CopyRates ( Symbol (), 0 , 0 , 100 ,rates); if (copied> 0 ) { Print ( "Bars copied: " +copied); string format= "open = %G, high = %G, low = %G, close = %G, volume = %d" ; string

Non Account Currencies

Hi I can't seem to find the info I'm looking for through searching. I was hoping someone could direct me to a good explanation of the below My account currency is GBP. I want to trade EUR/USD. I understand the maths to calculate everything I need for price per pip and margin calcs What I don't

Lot Sizing For Non Account Currencies

I was wondering if anyone would be kind enough to help with my lot size calculations. I have all the code working fine when the base currency is the same as the account currency . 1 I'm really struggling to understand what to do when the base currency isn't the same. I have looked in mql and general

Leverage and position sizing

Hi I'm trying to work out my lot sizes from account percentage. For example. (Profit in dollars÷s/l pips)÷10 dollars per pip. For example 25 pip stop loss with $20 risk. (25÷20)÷10= 0.08 lots. So plugging in my numbers gives me a lot size of 0.08 with this math. What I then don't understand is how

Possible Loss Of Data Due To Type Conversion Warning

Ive come across a warning when writing an expert advisor that I don't understand. I have some ideas on why I'm getting it but was hoping someone could clarify. I'm getting the warning possible loss of data due to type conversion warning when compiling the code attached. I know this error is normally