The logic is that all trades should be closed on opposite signal but only buy trades respect this rule. Sell trades are closed immediately. Buy and sell trades are executed properly when there is a buy or a sell signal, however calling these functions, CloseSellPositions() on Buy signal and
Hello traders. My code down here doesn't place trades when I select risk type as fixed amount or as a risk percent of the account balance . It only places trades when fixed lot size is selected in the user inputs. The CalculateLotSize function should calculate lot sizes based on stop loss distance
This function should return the highest price between the last two closed trades, i.e. from the open of the second last trade to the close of the very last trade. I don't know where I am going wrong. Help me out. //Returns highest price between the last two closed trades double Highest_Price(){
//Returns true if last two closed trades ended up in a loss or 0(breakeven) bool LastTwoTradesLost(){ double profitLossArray[]; int totalCount = 0 ; HistorySelect ( 0 , TimeCurrent ()); if ( HistoryDealsTotal ()> 0 ){ for ( int i= HistoryDealsTotal ()- 1 ; i>= 0 ; i--){ ulong
Hello coders. I am try to get how long the last closed position took in milliseconds, from entry to exit. The code below doesn't seem to produce what I want. Please advise. I am beginner in MQL5, so bear with me. struct DEALTIME{ long dealentryIn; long dealentryOut; }; DEALTIME time; int OnInit