NexusFi: Find Your Edge


Home Menu

 





Thinkscript to MT4 question


Discussion in ThinkOrSwim

Updated
      Top Posters
    1. looks_one spectra9 with 2 posts (0 thanks)
    2. looks_two rmejia with 1 posts (0 thanks)
    3. looks_3 imprimus with 1 posts (0 thanks)
    4. looks_4 chtulhu with 1 posts (0 thanks)
    1. trending_up 2,992 views
    2. thumb_up 0 thanks given
    3. group 3 followers
    1. forum 4 posts
    2. attach_file 0 attachments




 
Search this Thread

Thinkscript to MT4 question

  #1 (permalink)
spectra9
Jakarta Indonesia
 
Posts: 2 since May 2014
Thanks Given: 0
Thanks Received: 0

Hello everyone.

First of all, I hope I'm posting this in the correct forum.

I'm a complete newbie on Thinkscript as my daily platform is Metatrader. However I have a Thinkscript code that I'd like to convert to run on MT4. I can figure out most of the code, however some lines puzzle me.

 
Code
def VarA = Highest(high, VarP) - Lowest(low, VarP);
def VarR1 = if VarA == 0 and VarP == 1 then AbsValue(close - close[VarP]) else VarA;
def VarB = Highest(high, VarP)[VarP + 1] - Lowest(low, VarP)[VarP];

I'm interested in the Highest function used in the above code. At the first line, I assume the code "Highest(high, VarP)" will return the highest high of VarP bars back from the current bar (please correct me if I'm wrong here). However I cannot guess what the 3rd line is trying to do with the notation Highest(high, VarP)[VarP + 1]. It seems that the [VarP + 1] part is used as index, but an index to what exactly?

Please help me to understand the code above. Feel free to point me to any documentation which explain this kind of use of the function. I've searched through the online documentation but I can't find any instance where this function is used in this way.

Thanks and best regards.
S9

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
Better Renko Gaps
The Elite Circle
ZombieSqueeze
Platforms and Indicators
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
Exit Strategy
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
27 thanks
Diary of a simple price action trader
26 thanks
Tao te Trade: way of the WLD
23 thanks
My NQ Trading Journal
14 thanks
HumbleTraders next chapter
9 thanks
  #2 (permalink)
spectra9
Jakarta Indonesia
 
Posts: 2 since May 2014
Thanks Given: 0
Thanks Received: 0

Sorry for bumping, but, nobody really can help me explain the code?

Reply With Quote
  #3 (permalink)
 
rmejia's Avatar
 rmejia 
Puerto Rico
 
Experience: Intermediate
Platform: thinkorswim
Broker: TD Ameritrade
Trading: Options
Posts: 379 since Oct 2010
Thanks Given: 3,614
Thanks Received: 441


The number inside the [ ] is usually the lookback for the aggregation period. So it could be the previous Highest two periods ago [2] if the length is 1 (VarP).

Reply With Quote
  #4 (permalink)
imprimus
Bangalore + Karnataka/India
 
Posts: 1 since Apr 2013
Thanks Given: 0
Thanks Received: 0

Hi spectra9,

Your question is too old but, i came across currently. So, replying as per my best knowledge.

You can go through the thinkorswim reference manual.

====> def VarA = Highest(high, VarP) - Lowest(low, VarP);

Following link will give you details about highest function, you have been asking about.
please google (thinkorswim reference highest).
====> def VarA = Highest(high, VarP) - Lowest(low, VarP);
please google (thinkorswim reference def)
Similarly, you can find all the syntax and pre-defined function library information here.

Hope this helps you. surely it is too late. but in case you are still looking for it.

Thanks,
Imprimus.

Reply With Quote
  #5 (permalink)
chtulhu
Nashville+Tennessee
 
Posts: 8 since Feb 2020
Thanks Given: 1
Thanks Received: 3

what you have is part of the code.
post the complete code, you might get meaningful help

Reply With Quote




Last Updated on July 12, 2020


© 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