Intelligent Moving Average

For 4 simple moving averages, the script tests every single combination for maximum profitability and finds the best pair.

sma1 and sma2,
sma1 and sma3,
sma1 and sma4,
sma2 and sma3,
sma2 and sma4,
sma3 and sma4

And then paint the pair which get best performance. sma lengths are optional, so you can change lengths as you wish.

You will see in some charts that for example sma1 and sma2 pair was best perfrmance and colored on the chart but then sma2 and sma3 pair got better performance, so script starts to paint sma2 and sma3. so it's dynamic based on best performance.

keep in mind => length1 < length2 < length3 < length4 will be better

I didn't have enough time to test the script, so please comment when you test it.

by LonesomeTheBlue
Açık kaynak kodlu komut dosyası

Gerçek TradingView ruhuyla, bu komut dosyasının yazarı açık kaynak olarak yayınladı, böylece yatırımcılar bunu anlayabilir ve doğrulayabilir. Yazara tebrikler! Ücretsiz olarak kullanabilirsiniz, ancak bu kodun bir yayında yeniden kullanımı Kullanım Koşulları tarafından belirlenmektedir. Bir grafikte kullanmak için favorilerinize ekleyebilirsiniz.

Bu komut dosyasını bir grafikte kullanmak ister misiniz?


Rushed here as quick as I could when someone told me that you had published an intelligent moving average. Incredible work my friend, truly amazing.

Do you think it would be possible for you to cook up an iteration that takes two moving averages and then loops through every combination of lengths (between, say, 3 - 50 or something similar) to see what is the most profitable? I assume the logic would be similar to what you're doing here, but I'm not too sure.

Either way, well done, you're a gift
+2 Cevap Gönder
LonesomeTheBlue chrysopoetics
@chrysopoetics, thank you for the comment. yes it's possible and it's my plan but in current pine version v3 there isn't Array definition and this means it's a lot of codding. as I know pine v4 will be released in this year. I will definitely work on this. on the other hand as I know some developers already did this and selling. If I have enough time I will work on it and I plan to share it free of charge.
+2 Cevap Gönder
chrysopoetics LonesomeTheBlue
@LonesomeTheBlue, you’re an absolute gentleman. I would have imagined it would have taken quite a lot of coding, but you’ve done a great job with this, so if there’s any man for the job, who better than you?

So out of curiosity, if I was to extend your logic from this script, it should work for the idea you have, right? I might try my hand at it (don’t think I’ll get half the distance you did) and send on to you whatever I come up with.

But yeah, I’ve noticed this is a profitable idea and I’ve been waiting for a knight in open-source armor to come and liberate us all.
Cevap Gönder
LonesomeTheBlue chrysopoetics
@chrysopoetics, it will give an idea about moving average really works or not, I believe it works (at least as sentiment, traders psychology) and we can see the best one. very good to hear you gonna work on this. please do not hesitate to send me message while you are working on extended version.
+2 Cevap Gönder
chrysopoetics LonesomeTheBlue
@LonesomeTheBlue, I agree, I think MAs can be used to great effect when treated with respect and applied with stellar risk management. I have a relatively large script for studying different types of MAs. It's pretty rudimentary at the moment, but when I release it I'll get to updating it every week, so eventually it'll be clean.

I'll definitely pass on any revelations to you, but don't hold your breath, I don't know how well I'll do. You're leading the charge at the moment.
+1 Cevap Gönder
GrantPeace chrysopoetics
Not original work unfortunately. Looks like a failed intention to copy
Cevap Gönder
@GrantPeace, first of all thanks for the comment and what you have done is good work. as a computer science & engineer I must comment; there is no intelligent moving average in TV and with pine it looks not possible to develope such things here. all of them are just parameter optimization at all. machine learning is far away than parameter optimization. here I just wrote this script and share the code to show how parameter optimization could be done with pine. thank you
+3 Cevap Gönder
yop127 GrantPeace
@GrantPeace, Is this a joke? Anybody can try to do a moving average optimization. There is no intellectual property here, and he is not making any money out of this.
+5 Cevap Gönder
greenmask9 GrantPeace
@GrantPeace, It's not a copy, you should know best, that your algorithm works differently. Unfortunately, it almost never finishes the calculation before the timeout (and you can see I am PRO+ owner). Can you update the paid version?
Cevap Gönder
GrantPeace greenmask9
@greenmask9, Go for it. You might as well check 5 different lengths manually :p
It's not a successful copy even though it was suppose to be.
Cevap Gönder