NexusFi: Find Your Edge


Home Menu

 





Help me to understand these couple lines of code


Discussion in ThinkOrSwim

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




 
Search this Thread

Help me to understand these couple lines of code

  #1 (permalink)
 shantzzz 
pittsburgh, pa
 
Experience: Intermediate
Platform: sierra, ToS
Trading: /es
Posts: 4 since Nov 2019
Thanks Given: 2
Thanks Received: 1

def low = chart < chart[1] and chart < chart[-1];
def high = chart > chart[1] and chart > chart[-1];
def lowcount = if low[1] then 1 else lowcount[1] + 1;
def highcount = if high[1] then 1 else highcount[1] + 1;
AddOrder(OrderType.BUY_TO_OPEN, low and lowcount <= 5);
AddOrder(OrderType.SELL_TO_OPEN, high and highcount <= 5);

What does this script do exactly? Does this trigger a BUY when there is a low in the variable "chart" and a SELL if there is a high within 5 bars? Also, are the "low" and "high" variables of the Boolean type?

Appreciate the help of all more knowledgeable than me ie practically all of you.

Started this thread Reply With Quote




Last Updated on November 7, 2019


© 2024 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 - Privacy Policy - Downloads - Top
no new posts