RSI EA on a one-second timeframe - page 2

 
@85pebs #: Is using the tick data on the seconds in mt5 different to this? Essentially I’m a scalper using the 5s/15s timeframes to trade but mt5 doesn’t have seconds timeframes charts. If you were to use this same concept on mt5, would it be a similar process?

Yes! MT5 keeps historical tick data so you don't need to collect the tick data yourself. You can just access it and process it directly, producing whatever time-frame you wish, even non-standard ones, even the likes of range bars or renko.

 

Hi @Fernando Carreiro,

I’ve made a good start with creating my own code I believe. I’m a primary school teacher so have been working long hours but I’ve managed to watch a 4.5-hour mql4 tutorial on YouTube this week so I understand a lot more of the basics. Fortunately, there are many similarities with Microsoft Excel’s VBA language too which I’m slightly-better-than-beginner with.

I was just wondering (hoping) I could show you my rough starting point tomorrow and you could give me some guidance please? I've requested you as a friend on here.

CPerry.

 
CPerry #: I was just wondering (hoping) I could show you my rough starting point tomorrow and you could give me some guidance please? I've requested you as a friend on here.

My apologies, but I no longer provide private services for anyone, be it coding, tutoring, support, or mentoring. Instead, I ask that you rely on using this or any other forum for help and guidance.

However, requesting for general guidance and for your entire code to be evaluated may end up with too many diverging opinions being given, or no comments at all.

It may be more productive to ask for help on specific points you have difficulty or issue with as you progress with your code.

 

Hi @Fernando Carreiro,

Gutted but I understand, wish I’d have caught you at an earlier point when you were doing so. I’ve spent tonight breaking down my queries into more digestible snippets. It’s funny, first you need to understand what you don’t understand. I’ll bleed these into the forum over the next few days as I work on the various moving parts but I do have a first question if I may:

Can I use SetIndexBuffer instead of an array inside of iRSIOnArray as from my research - I believe with an index buffer - MetaTrader will automatically move the values in this as new bars are created on the chart and will automatically handle the moving and shifting of old values as they fall off the end of the array, like a rolling array. Is this correct? Is it slower than using an array? Is there anything else I should consider if I went with this approach?

CPerry.

 
CPerry #: Can I use SetIndexBuffer instead of an array inside of iRSIOnArray as from my research - I believe with an index buffer - MetaTrader will automatically move the values in this as new bars are created on the chart and will automatically handle the moving and shifting of old values as they fall off the end of the array, like a rolling array. Is this correct? Is it slower than using an array? Is there anything else I should consider if I went with this approach?

Yes, you can use buffers in an Indicator (not in an EA), but given that the lowest standard time-frames is for M1, and your intention is to work on seconds, an indicator buffer will not serve your purpose.

As I suggested before, you don't need to use an array either. You can very well use incremental calculations at the start of each new second, which will be much faster and resource efficient.

You will just have to use the incremental or online version of the RSI equation, which is how it's creator, J. Welles Wilder, originally used it. For his original equation, he used his Wilder Moving Average (called Smoothed Moving Average on MetaTrader), which is just an EMA with a different weight equation, namely ( 1 / Period ) instead of (2 / ( Period + 1) ) on a normal EMA.

The RSI used by MetaTrader, uses a Simple Moving Average instead of the Wilder Moving Average (Smoothed Moving Average), because an SMA uses less history data for the calculation, but at the expense of loosing its Incremental/offline ability the original has.

When the RSI was first created, there were no personal computers on a traders desk. Everything needed to be calculated by hand (mentally), so the incremental nature of the RSI calculations made life much easier for a trader.

 
Fernando Carreiro #:

Yes, you can use buffers in an Indicator (not in an EA), but given that the lowest standard time-frames is for M1, and your intention is to work on seconds, an indicator buffer will not serve your purpose.

As I suggested before, you don't need to use an array either. You can very well use incremental calculations at the start of each new second, which will be much faster and resource efficient.

You will just have to use the incremental or online version of the RSI equation, which is how it's creator, J. Welles Wilder, originally used it. For his original equation, he used his Wilder Moving Average (called Smoothed Moving Average on MetaTrader), which is just an EMA with a different weight equation, namely ( 1 / Period ) instead of (2 / ( Period + 1) ) on a normal EMA.

The RSI used by MetaTrader, uses a Simple Moving Average instead of the Wilder Moving Average (Smoothed Moving Average), because an SMA uses less history data for the calculation, but at the expense of loosing its Incremental/offline ability the original has.

When the RSI was first created, there were no personal computers on a traders desk. Everything needed to be calculated by hand (mentally), so the incremental nature of the RSI calculations made life much easier for a trader.

@Fernando Carreiro

Thank you for the reply, yeah it was for the purpose of using it within an EA I was exploring so that's answered my question. 

I did a bit of research on Wilder when I first learned about the RSI, I do enjoy doing that sort of background reading to get a better understanding of things. In my analysis, I used:

100 - (100/(1+Average Gain/Average Loss)) where my average wins and losses were simple mean averages in Excel's VBA.

I've got the outline of my EA all mapped out now and have highlighted the areas I need to focus on over the weekend. After work (teaching and tutoring until 7pm UK time *sigh*), i'll finally have a bit of time this week to knuckle down. Thank you for the ongoing support.

Reason: