Forum

HELP: This function should return the highest price between the last two closed trades.

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(){

HELP NEEDED: Help with this function. The function should return true if the last two consecutive trades closed with a loss or with 0 profit.

//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

Getting how long the last closed position took

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