HI. I don't do it on purpose with these errors. I can't figure out how to fix the array out of range.
I'm trying to create my own set of candlestick patterns.
If I remove the - 2 on shift2, the code seems to work fine. That is, I don't notice any printing errors on the graph and it reflects what I would like to create and then display. There's a typo on the graph and I don't like it very much. I think I can fix it by working on it a little. And maybe it can be improved to make the patterns better. I think I can do it myself by adding some extra values for filtering.
When I add the - 2, it gives me the problem. I tried using the + sign in the two shifts instead of the - sign. It doesn't work as I would like. Single candles have no problems. The ones with more candles are marked in a way that I don't like very much.
Could someone kindly direct me to the solution to the problem or give me a hand?
I thank you infinitely
Re: Help to understand how to fix the array out of range
2HI. I managed to remove array out of range. in a slightly different way than I had tried. The problem I noticed remains. Patterns that require 2 or more candles don't convince me. it manages to mark candles perfectly, but there are candles that seem to me to be signaled earlier than the pattern.
I took some screenshots.
Can anyone help me understand how I can fix it?
thank you so much
I took some screenshots.
Can anyone help me understand how I can fix it?
thank you so much
Re: Help to understand how to fix the array out of range
3Would have to see the original version, also one thing is far as I know #property strict is not needed in mt5.Luke wrote: Tue Nov 28, 2023 2:53 am HI. I managed to remove array out of range. in a slightly different way than I had tried. The problem I noticed remains. Patterns that require 2 or more candles don't convince me. it manages to mark candles perfectly, but there are candles that seem to me to be signaled earlier than the pattern.
I took some screenshots.
Can anyone help me understand how I can fix it?
thank you so much
Re: Help to understand how to fix the array out of range
4HI. I managed to fix the array out of range. Now I don't know if this is the best method. It seems to work and I don't notice any strange placements.
I have a couple of errors that I can't see.
both the inverted hammer and the shooting star are not displayed. I've checked the code several times and I don't see any errors. Can you point out where I went wrong?
I converted the tradingview code for candlestick patterns. I can't figure out how I can convert this function C_BodyAvg = ta.ema(C_Body, C_Len) in metatrader 5.
I managed to create the ema handle and the copybuffer.
Thank you so much
I forgot to add a file. Excuse me
I have a couple of errors that I can't see.
both the inverted hammer and the shooting star are not displayed. I've checked the code several times and I don't see any errors. Can you point out where I went wrong?
I converted the tradingview code for candlestick patterns. I can't figure out how I can convert this function C_BodyAvg = ta.ema(C_Body, C_Len) in metatrader 5.
I managed to create the ema handle and the copybuffer.
Thank you so much
I forgot to add a file. Excuse me
Attachments
Re: Help to understand how to fix the array out of range
5HI. I have made some changes since the last version. I created a class for the candlestick pattern.
I tried several times to create the function for calculating the body length starting from the ta.ema function:
What I understood for nz() can be used mathisvalidnumber. For na() it should match a check if the value is nan then you set it to 0.0.
I created some code that doesn't even work well. It's not a reproduction of the ema function because I'm not that good at programming and from what I see in the printouts, I don't really like how it works. Can you help me understand or post a link to an indicator so I can study it by looking at how it was made?
I thank you infinitely
I tried several times to create the function for calculating the body length starting from the ta.ema function:
Code: Select all
pine_ema(src, length) =>
alpha = 2 / (length + 1)
sum = 0.0
sum := na(sum[1]) ? src : alpha * src + (1 - alpha) * nz(sum[1])
plot(pine_ema(close, 15))
I created some code that doesn't even work well. It's not a reproduction of the ema function because I'm not that good at programming and from what I see in the printouts, I don't really like how it works. Can you help me understand or post a link to an indicator so I can study it by looking at how it was made?
I thank you infinitely
Attachments