TradingView
dc4free
7 feb 2020 07:56

Slow Heiken Ashi and Exponential Moving average Strategy 2.2 

Bitcoin / US Dollar Perpetual Inverse Swap ContractBitMEX

Beskrivning

Strategy using Slow Heiken Ashi by Glaz and Exponential moving averages. Looking for someone to help me turn the strategy into non-reoccuring alerts as I am having trouble doing so.

Versionsinformation

This is as far as I am able to get trying to eliminate recurring alerts.

Versionsinformation

Still trying to get rid of reoccuring alerts.

Versionsinformation

Was able to fix some of the alerts, but it's still reoccuring at times.
Kommentarer
dc4free
@Jomy tried doing the same thing to this script and I got no plots. Very confused to say the least.
Jomy
I see what's happening. LONG=longswitch==1 and longswitch==0 When you cut and paste this line, it deletes the square brackets. The second "longswitch" should be the longswitch from one bar ago. And square brackets with a 1 after the second longswitch. I would type it out but the chat in here will delete my square brackets and whatever is in them.
Jomy
also where it says "nz(longswitch)" and "nz(shortswitch)" it should say "nz(shortswitch-1-)" and nz(shortswitch-1-)" . You will have to change the "-" to square brackets.

hope that works for you.
dc4free
Hey @Jomy, been editing my script and was able to get rid of some of the false alerts, but there are still some reoccuring and/or close_longs where shorts should be and vice versa. Are you able to see what I'm doing wrong?
Jomy
@noscoobies_drew, sure. Can you let me know if the script posted above is the latest version of the script? If not, can you send the lastest version. I'll try to take a look at it tonight. Right off the bat, your problem might stem from trading off the Heiken Ashi chart, because it's not true chart data. I don't know because I've never traded using the Heiken Ashi bars. You will notice every strategy gets somewhat better to way better when applied to the Heiken Ashi chart, because the chart is a lie and that's not the *real* price action.
dc4free
@Jomy, yes, it's the latest version. Not sure what you mean about the Heiken Ashi chart though because I turned off plotcandle for the heiken ashi bars
Jomy
@noscoobies_drew, your code is kind of weird in this part:

if long
strategy.entry("LONG", strategy.long)
strategy.close("LONG", when = _close)

this means if the conditions for 'long' are true, open a trade.
the next line means if the conditions for 'long' are true, and the conditions for '_close' are also true, to close the trade

Looking at how '_close' is defined, it is true when a long or short was closed 2 bars ago.

So to open a long trade it asks did we close a long or short trade 2 bars ago and have a long signal now? I tried to straighten that out, but it dropped the profit factor of your indicator. What it does in the version I posted below, is it asks, "if we have a close signal and we were already long, then close the long."

If you want the signals it to perform like how your version shown above is trading, I can change the longswitch and shortswitch to behave like that, but I've dropped you a link to how I think your code was intended to perform. I put a green bar when a long starts, and green area for the duration it's in a long, and red for shorts, so it's a little easier to see what is happening.

Hope all that makes sense.

dropbox.com/s/xovtbah1usbev5r/scoobyfix.txt?dl=0
Mer