Forum

Close an Open Position if Hit certain price

i'd like to make my EA to close a position if any of these conditions were met : -profit on the position is 100 points -price hit RSI 30 OR 70 depending if it's a Sell or buy Here's my code but for some reason it doesn't work !! Also i'm not quite sure whether "PositionGetDouble " return profit

Expert doesn't perform any trades!

i made my expert locked by certain account number and with time constraint and can only work on a demo account , the problem is that it doesn't perform any trades ! static datetime allowed_until = D' 2020.12 . 30 00 : 00 '; const long allowed_accounts = 11111111 ; int

Logic for 2-step signal verification EA

i'd like to code EA which has a 2 step signal , if something happens ( like a cross ma or anything ) , then wait for 1-5 candles to see if another behavior happens and only then give me the signal the problem i'm facing is that after the first check , i don't know how to keep the value static for 5

Merging Multiple strategies into one EA

i have multiple strategies , when i add them in one EA , i assumed that all profits will be added up but the end profit was less than that. For Example , 1. strategy one yields 1000$ profit separately 2. strategy two yields 5000$ profit separately 3. strategy three yields 2000$ profit separately

Position modifying and partial close

i have a take profit of " 150 " points but , I'd like to partially close a position if it get 50 points profits then modify the remaining position with a take profit ( 100 points) , here's my code the problem is that the position closes fully at 50 points , i understand why but can't figure out how

Execute one trade per signal

i'd like to only make one trade per signal in other words "per new bar" here's my implementation with wrapping the logic within "IsNewCandle" function but the problem is that the expert makes few trades compared to not using the "IsNewCandle" function and instead limiting buy and sell orders to one

Multi-currency EA doesn't perform any trades

i'm trying to make EA iterate over number of symbols but it only performs trades on the symbol specified in the strategy tester ! could you help me find the error #define EURUSD "EURUSD" #define GBPUSD "GBPUSD" #define USDJPY "USDJPY" #define USDCHF "USDCHF" #define USDCAD

Create multi-currency EA

i'd like to make my EA iterate through symbols , but for some reason the code isn't working void OnTick () { for ( int i= 0 ;i< SymbolsTotal ( true );i++) { string sym = SymbolName (i, true ); MqlRates pricedata []; ArraySetAsSeries (pricedata, true ); int data =

Delete Pending order if price moved

i'd like to delete a pending order if the price moved 500 points without executing it Here's my attempt CTrade trade; MqlRates pricedata []; ArraySetAsSeries(pricedata,true); int data =CopyRates(Symbol(),Period(),0,550,pricedata); for ( int i = OrdersTotal () - 1 ; i >= 0 ; i-- ) { ulong

Get Last FIXED values of ZigZag indicator in my EA

i'd like to access the last three fixed values of ZigZag Highs indicator (standard one) i have seen other threads discussing the same problem but they are all in mql4 and i use mql5 Here's my code ,but no matter i change the indices , it only produces the last non fixed value of the High