Gamestudio Links
Zorro Links
Newest Posts
Blobsculptor tools and objects download here
by NeoDumont. 03/28/24 03:01
Issue with Multi-Core WFO Training
by aliswee. 03/24/24 20:20
Why Zorro supports up to 72 cores?
by Edgar_Herrera. 03/23/24 21:41
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 945 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
MMI and Thinkscript - Think or Swim #475451
12/10/18 22:56
12/10/18 22:56
Joined: Oct 2018
Posts: 70
AZ
C
chsmac85 Offline OP
Junior Member
chsmac85  Offline OP
Junior Member
C

Joined: Oct 2018
Posts: 70
AZ
I'm trying to convert the lite C version of MMI into thinkscript so that I can use MMI with think or swim.

I've coded up the following but I'm not 100% sure it's doing what it's supposed to do as the iterator logic is different in thinkscript than anything I've seen. Thinkscript uses fold instead of for loops. See https://tlc.thinkorswim.com/center/reference/thinkScript/Reserved-Words/fold.html

The trickiest part was calculating nh and nl as these are iterated for each price in the lookback series.

The input mmiLength section lets the user define how far back you want to look. I choose 150 as a default value based off of a previous post from JCL that said 100-200 bars is a good compromise.

Here's my solution. Anyone see any problems with it?

input mmiLength = 150;
def m = Median(close, mmiLength);

def nh = fold i = 1 to mmiLength+1 with p = 0 do if close[i] > m and close[i] > getValue(close, i + 1) then p+1 else p+0;

def nl = fold j = 1 to mmiLength+1 with q = 0 do if close[j] < m and close[j] < getValue(close, j + 1) then q+1 else q+0;

plot mmi= 100*(nl+nh)/(mmiLength-1);

Re: MMI and Thinkscript - Think or Swim [Re: chsmac85] #475452
12/11/18 00:45
12/11/18 00:45
Joined: Aug 2018
Posts: 98
O
OptimusPrime Offline
Junior Member
OptimusPrime  Offline
Junior Member
O

Joined: Aug 2018
Posts: 98
Hi chsmac85:

This is a Zorro specific forum.. We are trying to learn and improve our use of Lite-C specifically. Did you try a similiar forum specifically for ThinkorSwim coding?


Thanks so much,

OptimusPrime

Re: MMI and Thinkscript - Think or Swim [Re: OptimusPrime] #475453
12/11/18 02:36
12/11/18 02:36
Joined: Oct 2018
Posts: 70
AZ
C
chsmac85 Offline OP
Junior Member
chsmac85  Offline OP
Junior Member
C

Joined: Oct 2018
Posts: 70
AZ
sorry I didn't. I considered MMI to be a part of the zorro family and posted in the brokers section given think or swim is a platform for a very popular broker. But that's fine, I can look for help elsewhere.


Moderated by  Petra 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1