Forum

How To hedge properly?

I want to hedge but my ea will only open trades both(buy & sell) at the same instead of 10 pips. please help if you know the problem #property copyright "Copyright 2022, MetaQuotes Ltd." #property link " https://www.mql5.com " #property version "1.00" #property strict #include

Objects Disappear problem

Hi all, my objects disappear & after a few seconds or so they reappear again. If you know the problem please help. void OnTick () { int Bottom= iLowest ( Symbol (), 0 , MODE_LOW , 75 , 1 + 40 ); ObjectDelete ( 0 , "Bottom" ); ObjectCreate ( 0 , "Bottom" , OBJ_RECTANGLE , 0 ,Time[ 0

Pending TakeProfit Problem

I have a problem when my EA places a pending order and my trade hits TP. I get lot size (0.01)* 5pips = 0.42 profit instead of 0.50. With JPY pairs its less 0.37 etc. Here is my code below, please help if you know the problem. extern double TakeProfit= 5.5 ; int MagicNumber; int MaxTrades= 0 ; int

How to set Takeprofit not in pips but as closing in profit?

I would like to set my TakeProfit as closing in profit and not in pips. Below is my code closing in profit. for ( int Loop= OrdersTotal ()- 1 ;Loop>= 0 ;Loop--) { if ( OrderSelect (Loop,SELECT_BY_POS,MODE_TRADES)) if (OrderSymbol()== Symbol ()&&OrderMagicNumber()==MagicNumber) { bool

How to modify pending orders (BuyStop & SellStop) ?

Hi All I would like to modify pending orders (BuyStop & SellStop). It only modifies once instead of several times. Please help if you know the problem. #property strict extern double TakeProfit= 10.5 ; extern double StopLoss= 10.5 ; int MagicNumber= 10 ; int DelayTime= 1 ; static datetime

How to prevent EA to open order/s on multiple pairs?

Hi all I want to run my EA on all pairs but to open on one pair only. So for an example, EA is currently running on EUR/USD,GBP/USD,XAU/USD etc. The EA decides to open a trade/s on EUR/USD, my EA will open trade/s on other pairs. Please help on how I can prevent this from happening. #property strict

StringGetCharacter is preventing my ea from trailing

Hi all, I'm having a problem as to why StringGetCharacter is preventing my ea from trailing. #property copyright "Copyright 2022, MetaQuotes Ltd." #property link " https://www.mql5.com " #property version "1.00" #property strict #include <Trade\Trade.mqh> #include <Trade\SymbolInfo.mqh>

EA will not open sell order (sell stop) & opens too many orders

Hi all My EA will not open sell stop orders & opens too many orders instead of 1. If you know the problem please help. #property copyright "Copyright 2022, MetaQuotes Ltd." #property link " https://www.mql5.com " #property version "1.00" #property strict #include <Trade\Trade.mqh> #include

For Loop & Array problem

Hi all, I would like to open my trades when a certain amount of figures is reached so that the EA can open x amount of trades. So for example: 2 figures 1 trade, 5 figures 2 trades, 7 figures 4 trades. I know there's is a way as i have tried using the following: for (a;a< 1 ;a++) for (a2;a2< 2

How to open a trade when price touches a object?

Hi All I would like to open a trade when price touches a object(Buy/Sell). With the code below it will open in between the objects. extern int MagicNumber= 1 ; int MaxTrades= 0 ; //+------------------------------------------------------------------+ //| Expert tick function