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)
ZigZagHighLow of ThinkSwim to EasyLanguage of TradeStation
How to convert the following ThinkScript to EasyLanguage?
====
def EI = ZigZagHighLow("price h" = high, "price l" = low, "percentage reversal" = .01, "absolute reversal" = .05, "atr length" = 5, "atr reversal" = 2.0);
def EISave = if !IsNaN(EI) then EI else GetValue(EISave, 1);
def chg = (if EISave == high then high else low) - GetValue(EISave, 1);
def isUp = chg >= 0;
def EIL = if !IsNaN(EI) and !isUp then low else GetValue(EIL, 1);
def EIH = if !IsNaN(EI) and isUp then high else GetValue(EIH, 1);
def dir = if EIL != EIL[1] or low == EIL[1] and low == EISave then 1 else if EIH != EIH[1] or high == EIH[1] and high == EISave then -1 else dir[1] ;
def signal = if dir > 0 and low > EIL then if signal[1] <= 0 then 1 else signal[1] else if dir < 0 and high < EIH then if signal[1] >= 0 then -1 else signal[1] else signal[1];
plot upArrow = signal > 0 and signal[1] <= 0;
upArrow.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
plot downArrow = signal < 0 and signal[1] >= 0;
downArrow.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
===
The big problem is ZigZagHighLow, I guess. I see the code for EasyLanguage zigzag code here at traders.com/Documentation/FEEDbk_docs/2019/03/TradersTips.html
but, I cant put together. Any pointer would be highly appreciated.. Thanks!
Can you help answer these questions from other members on NexusFi?
Well, I see the zigzag code as posted in the previous URL, but I cant plug that into a strategy/indicator.. basically buy and sell points should be identified in zigzag code. Thanks!
Okay, understood. I don't think you can write a strategy for zigzag, at least one that can be properly backtested. I looked at this last year for a little bit, but threw it away. When watching a live chart, you will see how the zigs and zags are formed.