NexusFi: Find Your Edge


Home Menu

 





ThinkScript Help needed with a simple strategy


Discussion in ThinkOrSwim

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




 
Search this Thread

ThinkScript Help needed with a simple strategy

  #1 (permalink)
Pongor
Austin + TX/USA
 
Posts: 5 since May 2015
Thanks Given: 0
Thanks Received: 0

I am trying to learn how to program a strategy for ThinkorSwim but I am either not very suited to programming or just plain dumb.

I am trying to enter a trade long if the current price is 5 ticks above an SMA but have had issues trying to work out the code. I have a Fast SMA Envelope on my chart with a third slow SMA. If the price is five ticks above the upper SMA and the envelope is above the slow SMA then enter long with a trailing stop 2 ticks below the lower Fast SMA in the envelope. And vice versa for a short entry. It is a simple trending strategy that I want to test on a number of different contracts but having issue with the automated trade entry semantics.

This is what I have so far.

# Input Declarations:
#
input opentime = 0830;
input closetime = 1600;
input priceHigh = high;
input priceLow = low;
input priceClose = close;

input lengthFast = 5;
input lengthSlow = 50;

input entry_price = 5.0;

input displace = 0;

plot SMA_High = Average(priceHigh[-displace], lengthFast);
SMA_High.SetDefaultColor(GetColor(8));

plot SMA_Low = Average(priceLow[-displace], lengthFast);
SMA_Low.SetDefaultColor(GetColor(5));

plot SMA_Close = Average(priceClose[-displace], lengthSlow);
SMA_Close.SetDefaultColor(GetColor(1));

Thanks in advance to anyone who can shove me the right direction.

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Trade idea based off three indicators.
Traders Hideout
Quant vue
Trading Reviews and Vendors
Better Renko Gaps
The Elite Circle
REcommedations for programming help
Sierra Chart
How to apply profiles
Traders Hideout
 
  #2 (permalink)
 Dbjergins 
Joaquin Texas
 
Posts: 8 since May 2015

Hello there, has anyone given you a hand yet. I am going to take a look at what you are trying to setup today and will get back to you. I need the practice programming thinkscript and this seems like a fairly straightforward place to jump in. I'll post back with what I have for you to look at.

Regards,
David

Reply With Quote
  #3 (permalink)
Pongor
Austin + TX/USA
 
Posts: 5 since May 2015
Thanks Given: 0
Thanks Received: 0



Dbjergins View Post
Hello there, has anyone given you a hand yet. I am going to take a look at what you are trying to setup today and will get back to you. I need the practice programming thinkscript and this seems like a fairly straightforward place to jump in. I'll post back with what I have for you to look at.

Regards,
David

Hi David,

Thanks for looking at this for me. I must admit that I have been tied up with study for college since I posted and haven't yet found a good ThinkScript tutorial course. I think the strategy is simple, it should be just for trending instruments. I appreciate any help you can provide. If you need more information on the strategy I can pm you a short document on it.

Thanks again

Pongor

Reply With Quote
  #4 (permalink)
 Dbjergins 
Joaquin Texas
 
Posts: 8 since May 2015


Pongor View Post
Hi David,

Thanks for looking at this for me. I must admit that I have been tied up with study for college since I posted and haven't yet found a good ThinkScript tutorial course. I think the strategy is simple, it should be just for trending instruments. I appreciate any help you can provide. If you need more information on the strategy I can pm you a short document on it.

Thanks again

Pongor

Do you have a few minutes young man

Reply With Quote
  #5 (permalink)
Pongor
Austin + TX/USA
 
Posts: 5 since May 2015
Thanks Given: 0
Thanks Received: 0


Dbjergins View Post
Do you have a few minutes young man

Yes sir, how may I help

Reply With Quote
  #6 (permalink)
 Dbjergins 
Joaquin Texas
 
Posts: 8 since May 2015

Just to make sure we are using the same terminology could you email me the strategy doc that you mentioned. The programming Is the part I understand I am still learning some of the aspects of how the studies and strategies mathematical formulas are setup. I appreciate you letting me help with this. I started working with thinkscript a few months ago and really enjoy this part of it as much as the trading. It's not going to be difficult to set this up just about anyway you want it and add a few gizmos for fine tuning and customization. And it gives me some good practice in an area of TS that I haven't dealt with yet. My email is dbjergins at outlook dot com. This stupid forum wouldn't let me post my email so I had to type it goofy like that....sorry. I'll get right on it and try to have you something to check out in just a little bit.

thanks again and I hope school is going well
David

Reply With Quote
  #7 (permalink)
Pongor
Austin + TX/USA
 
Posts: 5 since May 2015
Thanks Given: 0
Thanks Received: 0

Sent David

Reply With Quote
  #8 (permalink)
tradingolives
chicago+il
 
Posts: 2 since Jun 2015
Thanks Given: 0
Thanks Received: 0

I'm trying to write a code for scanning for :-

- stocks that have reached their all time low.

and another code

-stocks that are 3% away from reaching their all time low.

is there anyone out there that could help me out?

Thank you

Reply With Quote




Last Updated on June 28, 2015


© 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