NexusFi: Find Your Edge


Home Menu

 





ZigZagHighLow of ThinkSwim to EasyLanguage of TradeStation


Discussion in EasyLanguage Programming

Updated
    1. trending_up 5,798 views
    2. thumb_up 0 thanks given
    3. group 2 followers
    1. forum 3 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
trader929
Alpharetta
 
Posts: 3 since Jul 2020
Thanks Given: 0
Thanks Received: 0

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!


Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Memorandum Watch: How the 60-Day MOU Framework Makes May …
Prediction Markets & Event Contracts
Warsh Drops Easing Bias, December Hike Now Above 50% -- …
Prediction Markets & Event Contracts
$500M Riding on World Cup 2026: France/Spain Co-Favored …
Prediction Markets & Event Contracts
Warsh Rate Hike at 40%, Iran June 15 Expires Tonight at …
Prediction Markets & Event Contracts
I Have a Thing Called Iran -- Trump Stays in DC as Airsp …
Prediction Markets & Event Contracts
 
  #2 (permalink)
 
vmodus's Avatar
 vmodus 
Somewhere, Delaware, USA
Legendary Systematic Algo Trader
 
Experience: Intermediate
Platform: MultiCharts
Broker: Barchart.com
Trading: Everything, it all tastes like chicken
Posts: 1,270 since Feb 2017
Thanks Given: 2,960
Thanks Received: 2,856


trader929 View Post
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!

Are you asking the opposite? The EasyLanguage code is there. Do you want to convert to ThinkScript?

If so, this should be posted over in the ThinkScript section.

~vmodus


Follow me on X Visit my NexusFi Trade Journal Reply With Quote
  #3 (permalink)
trader929
Alpharetta
 
Posts: 3 since Jul 2020
Thanks Given: 0
Thanks Received: 0


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!


Reply With Quote
  #4 (permalink)
 
vmodus's Avatar
 vmodus 
Somewhere, Delaware, USA
Legendary Systematic Algo Trader
 
Experience: Intermediate
Platform: MultiCharts
Broker: Barchart.com
Trading: Everything, it all tastes like chicken
Posts: 1,270 since Feb 2017
Thanks Given: 2,960
Thanks Received: 2,856


trader929 View Post
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.

Maybe someone else has a different perspective.

~vmodus


Follow me on X Visit my NexusFi Trade Journal Reply With Quote




Last Updated on July 13, 2020


© 2026 NexusFi®, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Downloads - Top
no new posts