Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
I'm on the road now so I'll respond more clearly when I'm back.
Getting the value of most recent swing hi/lo has confused me as close[0] doesn't have a value, and there are times when no hi|lo is drawn or has a null(zero?) value for some time. I'm sure its a "duh" thing that I am missing. In RJay's example its the "swing high" and "swing low" that has me stumped.
Totally OT to my own thread () I'm trying GoToMyPC for the first time and am chuffed that I can access my three-screen trading rig back home while sitting in a hotel in a different country with my laptop.
Piresh that is very close to what I am trying to do. Before I saw your code I wrote this:
Which doesn't work. You will see I'm trying an OR condition as well. The logic is;
The swing range needs to be wide enough OR the current SwingLow is 0 for shorts
The swing range needs to be wide enough OR the current SwingHigh is 0 for longs
I'll play some more and post it back!
EDIT TO ADD: For newcomers to Ninja Script [I include myslef in that comment!] you will see I'm making to simple mistakes in the code that I'm fixing as I go along. Look at the difference in the draw arrow code from this to the next.
If memory serves this is where I gave up when a first looked at Swing a few months back. I think the value of swing hight or low is zero some times and that throws the logic out of whack.
What appears to be happening is it only trades "breakouts" from the swing zone (fair enough, based on the entry trigger), but the 12 tick filter stays in place even if no new swing line is drawn on the chart by the indicator. What that means is if we are in a 14 tick swing range and it breaks out, a trade is put on. If we are in a 12 tick or less range and the price breaks out, it will NOT trade until a new swing range greater than 12 is drawn. So some of those lovely swing breakouts that keep climbing up or down are NOT traded if the previous swing range was <12... until they top or bottom out and a new swing range >12 is drawn by the indicator. Hmmm ...