RSI EXPERT ADVISOR


RSI EXPERT

This RSI expert advisor is based on the RSI indicator with regions above 70% show that the instrument is overbought, it provides a sell signal and when the line is below 30%, it indicates that the market has been oversold and creates a buy signal. The expert advisor trades immediately these conditions are met and has a stop loss of 0.003 and a take profit of 0.004 that modify as the trade is open, it also closes trades and opens new trades if the market sentiment changes from buy to sell and vice versa.

THE CODE

#include<Trade/Trade.mqh>

 

CTrade trade;

int RSIhandle;

        ulong tickets;

             int OnInit(){

     RSIhandle = iRSI(_Symbol,PERIOD_CURRENT,14,PRICE_CLOSE);     

   return(0);

  }

void OnDeinit(const int reason){

  }

void OnTick() {

          double rsi[];

          CopyBuffer(RSIhandle,0,1,1,rsi);

           if(rsi[0] >70) {

            if (tickets >= 0 && PositionSelectByTicket(tickets)){

            int posType = (int)PositionGetInteger(POSITION_TYPE);

             if(posType == POSITION_TYPE_BUY){

       trade.PositionClose(tickets);

    tickets = 0 ;

    }

   }

             if(tickets<=0){

       trade.Sell(0.01,_Symbol);

    tickets = trade.ResultOrder();

       }

   }

   else if(rsi[0] <30) {

             if (tickets >= 0 && PositionSelectByTicket(tickets)){

             int posType = (int)PositionGetInteger(POSITION_TYPE);

              if(posType == POSITION_TYPE_SELL){

        trade.PositionClose(tickets);

     tickets = 0 ;

    }

   }

              if(tickets<=0){

         trade.Buy(0.01,_Symbol);

    tickets = trade.ResultOrder();

   }

              if(PositionSelectByTicket(tickets)){

              double posprice = PositionGetDouble(POSITION_PRICE_OPEN);

              double posSL = PositionGetDouble(POSITION_SL);

              double posTP = PositionGetDouble(POSITION_TP);

              int posType = (int)PositionGetInteger(POSITION_TYPE);

  

                if(posType== POSITION_TYPE_BUY){ 

                  if(posSL==0){

                  double sl = posSL-0.003000;

                  double tp = posTP+0.004000;

    trade.PositionModify(tickets,sl,tp);

   }

  }            else if(posType==POSITION_TYPE_SELL){

                     if(posSL==0){

                     double sl = posSL+0.003000;

                     double tp = posTP-0.004000;

   trade.PositionModify(tickets,sl,tp);

   } 

     }

     }                  else{

     tickets=0;

     }

   }

   Comment(rsi[0],"\n",tickets);

 }

PROBLEM

The research paper is to check the performance of the RSI expert across different symbols, time frames and stress points for trades

Assumptions.

1.       5 yrs. look back period

2.       No forward rate

3.       Initial deposit $5000

4.       Leverage of 1:100

5.       Zero latency on delays

6.       Modelling is done on open prices only

7.       No optimization

 


 

0BSERVATIONS

 














CONCLUSION
















In this write-up, we delve into the back test results of a forex trading strategy across five major currency pairs (EUR/USD, GBP/USD, USD/CAD, AUD/USD, and USD/JPY) on different timeframes (5 minutes, 30 minutes, 1 hour, 4 hours, and 1 day). The back test provides valuable insights into the strategy's performance, risk management, and potential for real-world application. However, traders should exercise caution and consider various factors before deploying the strategy in live trading.

 

Performance Metrics:

The back test reveals several key performance metrics for each currency pair and timeframe:

 

Win Rate: Ranging from 32% to 71%, the win rate indicates the percentage of profitable trades, with some timeframes showing higher success rates than others.

 

Profit Factor: The profit factor, which is close to 1 for most cases, suggests that the strategy generated relatively balanced profits and losses.

 

Recovery Factor: Varying between negative values and 0.83, the recovery factor measures the strategy's ability to recover from drawdowns. Some timeframes show positive recovery factors, indicating a better recovery capability.

 

Expected Payoff: Fluctuating from negative values to 14.62, the expected payoff reveals the average profit per trade compared to the average loss. Higher values indicate more favorable profit potential.

 

Sharpe Ratio: The Sharpe Ratio ranges from negative values to 0.35, suggesting mixed risk-adjusted returns.

 

Z-score: The Z-score, varying from 0.07 to 2.00, indicates how far the strategy's returns deviate from the mean.

 

Risk Analysis:

Margin percentages as high as 49,122.80% show a significant usage of leverage, which could amplify potential losses and increase risk. Traders must be cautious when applying such high leverage.

 

Trade Analysis:

Short and long trades show comparable win rates, while profit trade win rates are also close to loss trade percentages for most timeframes.



RECOMENDATION

The back test results provide valuable insights into the performance and risk profile of the forex trading strategy across various currency pairs and timeframes. While some timeframes exhibit promising win rates and recovery factors, the overall risk-adjusted returns show room for improvement.

 

Traders should conduct further analysis and optimization, considering various market conditions, slippage, and risk management techniques, before implementing the strategy in a live trading environment. Continuous monitoring and adjustments are crucial for achieving successful and consistent results in forex trading. Additionally, past performance does not guarantee future success, and traders must exercise prudent decision-making and risk management to navigate the dynamic forex market successfully

 

Comments

Popular posts from this blog

102 : FINANCIAL MARKETS

104 : INSURANCE

MOVING AVERAGE EXPERT ADVISOR