# iRSI EA can not change from default value of 14 to 3?

9
2014.02.16 14:57

Hi,

I would like to change the RSI period to 3 from the default value of 14.

For some reason when i try to change the period to the value of 3. When i try to back test my strategy it will default the value to 15.

Does anyone else also has this problem or just me?

thanks you

My code are as below:

```//+------------------------------------------------------------------+

//| toy moving average EA.mq4 |

//| Copyright 2013, MetaQuotes Software Corp. |

//| http://www.metaquotes.net |

//+------------------------------------------------------------------+

extern double lots = 0.10;

extern int takeprofit = 100;

extern int stoploss = 100;

extern int magic = 1234;

extern int period = 3;//for change in RSI

//+------------------------------------------------------------------+

//| expert initialization function |

//+------------------------------------------------------------------+

int init()

{

//----

//----

return(0);

}

//+------------------------------------------------------------------+

//| expert deinitialization function |

//+------------------------------------------------------------------+

int deinit()

{

//----

//----

return(0);

}

//+------------------------------------------------------------------+

//| expert start function |

//+------------------------------------------------------------------+

int start()

{

//----

double R1,R2;

R1 = iRSI(NULL,0,Period(),PRICE_CLOSE,0);

R2 = iRSI(NULL,0,Period(),PRICE_CLOSE,1);

if(OrdersTotal()==0)// check if the order is currently no position

{

if (R2<30&&R1>30)

{

}

if (R2>70&&R1<70)

{

}

}

if(OrdersTotal()==1)//check if the order open is 1 or not

{

if(R2<30&&R1>30)

{

if(OrderType()==OP_SELL)//if the order is open sell

}

if(R2>70&&R1<70)

{

}

}

//----

return(0);

}

//+------------------------------------------------------------------+ ```
Moderator
31134
2014.02.16 15:21

Hello,

Please use the SRC button when you post code. Thank you.

This time, I edited it for you.

Moderator
31134
2014.02.16 15:24
toy5429274:

Hi,

I would like to change the RSI period to 3 from the default value of 14.

For some reason when i try to change the period to the value of 3. When i try to back test my strategy it will default the value to 15.

Does anyone else also has this problem or just me?

thanks you

My code are as below:

I guess you are running your backtest on M15 timeframe.

Where in this code is the period of RSI changed ?

14753
2014.02.16 15:42
toy5429274: I would like to change the RSI period to 3 from the default value of 14.
1. Where are you even trying to set it to 3?
```double iRSI(string symbol, int timeframe, int period, int applied_price, int shift)
R1 = iRSI(NULL,0,                            Period(),       PRICE_CLOSE,0);
^ Length of the RSI =  1 on M1  chart,
= 15 on M15 chart```
2. Check your return codes What are Function return values ? How do I use them ? - MQL4 forum
3. Adjust for 4/5 digit brokers