Forum

Buffer for custom value?

Hey everyone, I'm trying to figure out the best way to store a value in a buffer similar to CopyBuffer, but the value isn't from an indicator. Id like the EA to check if the value is higher or lower than the previous bar. Something like this: if(MyValue[ 0 ] < MyValue[ 1 ]) { //Do something...; }

Best way to handle Requotes?

Hey everyone, What is the best way to handle a requote within an EA? I set a deviation but to my understanding that only affects close orders. I need a way to have the EA retry opening an order if there is a requote. I'm using RefreshRates() before every buy/sell order (trade.Buy/trade.Sell) but I

Simple candle stick pattern EA issue

I'm working on developing a pattern based entry using this class: https://www.mql5.com/en/code/291 The code for my EA is simple: #include <CandlePatterns.mqh> CCandlePattern m_candle; int OnInit () { m_candle.ValidationSettings(); m_candle.InitIndicators(); m_candle.MAPeriod( 20 ); return (

Lot size based on percentage of balance

What would be the best way to go about calculating your lot size based on a percentage of your account? Lets say for example the balance is $1000 and you want to put 10% of the account into an order. 10% of 1000 = 100, so we would need to convert that to a lot size, or the nearest lot size. Any

Strategy tester appears to be skipping large chunks of time

Hi everyone. I'm having a strange problem with the strategy tester . I ran a test that started at 2015 until the current date and when I looked back at the chart it seems like the tester didn't place any trades for over a whole year, at two points even. Could this just be a visual bug? I attached

Trailing stop not working

I wrote some code for a trailing stop with the help of a tutorial and it works as it should: #include<Trade\Trade.mqh> CTrade trade; //+------------------------------------------------------------------+ //| |

Incorporating value from a custom indicator into EA

I'm looking to incorporate a value generated in this STC indicator into my EA: https://www.mql5.com/en/code/20281 On inspecting the code I discovered there is a data type called "valc" that holds a value (0, 1 or 2) - these numbers indicate whether the trend is going up (1) or down (2) Normally

Strategy tester and resulting graph don't match

I seem to be having a strange issue with the strategy tester and the graph it renders in MetaTrader. The strategy testing visualization is showing me what should be correct according to what I planned in my code. However the resulting graph that comes up in MetaTrader shows me something quite

EA Making trades way above High

Chart attached. Any reason why my EA is making buy orders way above the candle high? Doesn't seem to do this with sell orders in the opposite direction. It doesnt do this in all cases, just some of the time

Advisor keeps placing trades on every candle

Hi everyone, I'm new to the MT platform and so far I really like it. I've been developing my first advisor but I'm running into an issue. I pieced this script together from resources I found around the internet. I have basic coding skills but I'm certainly not a pro, so please excuse me if I'm