Forum

trailing stop movement after risk free

Hello friends My code works like this: In line 56, when the risk becomes 2 to 1, I want the trailing stop to be activated and the trailing stop to go up with each point that the price goes up. For this, I used to store the current price in a global variable. But when I opened several positions at

Store data by key and value in mql5

Hello friends, I want to save the highest price after opening a new position. This is easy when only one position is open, but it is difficult for me to implement it when several positions are open. In Python, I use a dictionary for a similar situation, for example, the { tiket : highPrice}. But in

Trailing stop based on profit percentage

Hello friends, I'm working on a trailing stop that closes the trade if the profit decreases by 10 percent. However, I don't know how to implement it. I would appreciate it if you could help or if you have a similar code, please introduce it to me. Thank you

Problem in calculating the result of subtraction of numbers in mql5

Hello friends The result of the following code equation is 21, if it should be -1!! Where is the problem, please help. Comment ( 10 - (- 11 ));

My script does not open positions in real trades in mql5

Hello, this is my code, it works well in the tester strategy, but when I put it in the main chart for real trades, it does not open a position. #include<Trade\Trade.mqh> CTrade trade; //+------------------------------------------------------------------+ //|

Unusual Trades Behavior in MT5 Chart

Half of the trades are executed without volume and closed without reaching the take profit or stop loss levels . The trade ticket is not displayed, but on the chart, they appear as a smooth line. #include <Trade\Trade.mqh> CTrade trade; void OnTick () { if ( PositionsTotal () == 0 ) {

Coding Issue: Repeated Trades without Closure at Inappropriate Times and Increasing Trade Ticket Numbers

Hello everyone, I'm facing an issue with my trading script that I need your help with. My problem is that the script keeps opening repeated trades without closing them properly, especially during inappropriate times. Another concern is that the trade ticket numbers are increasing inexplicably." "I'm

Issue with Accessing Profit and Loss Values of Closed Trades in MQL5

Hello dear community members, I'm facing an issue while writing an MQL5 script to access the profit and loss values of closed trades. In short, I've been trying to use the relevant functions to retrieve the profit and loss values, but I always end up getting 0.0 as the profit or loss value. I've