NexusFi: Find Your Edge


Home Menu

 





Thinkscripts


Discussion in ThinkOrSwim

Updated
      Top Posters
    1. looks_one RedK with 20 posts (15 thanks)
    2. looks_two pbenson68 with 15 posts (1 thanks)
    3. looks_3 RemoWilliams with 5 posts (1 thanks)
    4. looks_4 courier12 with 5 posts (0 thanks)
      Best Posters
    1. looks_one optntdr13 with 8.3 thanks per post
    2. looks_two Silvester17 with 8 thanks per post
    3. looks_3 Massive l with 3 thanks per post
    4. looks_4 RedK with 0.8 thanks per post
    1. trending_up 77,733 views
    2. thumb_up 73 thanks given
    3. group 52 followers
    1. forum 111 posts
    2. attach_file 32 attachments




 
Search this Thread

Thinkscripts

  #51 (permalink)
 
RedK's Avatar
 RedK 
Dubai, UAE
 
Experience: Intermediate
Platform: TOS, TradeStation
Broker: OX, TradeStation
Trading: Stocks & Basic Options
Posts: 171 since May 2012
Thanks Given: 44
Thanks Received: 145

@bpenson68, what's a tick counter can you tell me more? haven't come across anything like this in ToS...

Visit my NexusFi Trade Journal Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Trade idea based off three indicators.
Traders Hideout
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
ZombieSqueeze
Platforms and Indicators
Exit Strategy
NinjaTrader
How to apply profiles
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
36 thanks
Tao te Trade: way of the WLD
24 thanks
Spoo-nalysis ES e-mini futures S&P 500
24 thanks
Bigger Wins or Fewer Losses?
20 thanks
GFIs1 1 DAX trade per day journal
16 thanks
  #52 (permalink)
 pbenson68 
San Diego CA
 
Experience: Beginner
Platform: TOS
Trading: StocKs
Posts: 26 since May 2012
Thanks Given: 14
Thanks Received: 5


RedK View Post
@bpenson68, what's a tick counter can you tell me more? haven't come across anything like this in ToS...

In woodies Cci system there is 3 minute timer used to make trades. He uses 3 min bars. If the condition is met the trade is made with 20 secs left on the timer

When using tick aggregation, let's say 133 ticks per bar, a tick counter would let you know how many ticks were left before the bar closes, it could be used to pull the trigger if the condition looked for is met, for example early entry on cci breaking 45 after 100
Ticks

Here is link to someone who was searching for it on trade station
Tick Counter for Tradestation - TL - 3480

Reply With Quote
  #53 (permalink)
bldrmtnman
Oakhurst CA USA
 
Posts: 3 since Jul 2012
Thanks Given: 3
Thanks Received: 1


I was hoping you might be able to guide me or tell me what to add to the code below to have the SMA green on incline and red on flat or decline, with the option of being able to turn colorizing off and have it be a chosen color. In other words my 100, 200 SMA i want to be a chosen color while the 50 SMA I want to change colors depending on direction. Below is the default thinkscript for the SMA

input price = FundamentalType.CLOSE;
input aggregationPeriod = AggregationPeriod.DAY;
input length = 9;
input displace = 0;
input showOnlyLastPeriod = no;

plot DailySMA;

if showOnlyLastPeriod and !IsNaN(close(period = aggregationPeriod)[-1]) {
DailySMA = Double.NaN;
} else {
DailySMA = Average(fundamental(price, period = aggregationPeriod)[-displace], length);
}

DailySMA.SetDefaultColor(GetColor(1));
DailySMA.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

Reply With Quote
  #54 (permalink)
 
RedK's Avatar
 RedK 
Dubai, UAE
 
Experience: Intermediate
Platform: TOS, TradeStation
Broker: OX, TradeStation
Trading: Stocks & Basic Options
Posts: 171 since May 2012
Thanks Given: 44
Thanks Received: 145


bldrmtnman View Post
I was hoping you might be able to guide me or tell me what to add to the code below to have the SMA green on incline and red on flat or decline, with the option of being able to turn colorizing off and have it be a chosen color. In other words my 100, 200 SMA i want to be a chosen color while the 50 SMA I want to change colors depending on direction. Below is the default thinkscript for the SMA

input price = FundamentalType.CLOSE;
input aggregationPeriod = AggregationPeriod.DAY;
input length = 9;
input displace = 0;
input showOnlyLastPeriod = no;

plot DailySMA;

if showOnlyLastPeriod and !IsNaN(close(period = aggregationPeriod)[-1]) {
DailySMA = Double.NaN;
} else {
DailySMA = Average(fundamental(price, period = aggregationPeriod)[-displace], length);
}

DailySMA.SetDefaultColor(GetColor(1));
DailySMA.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

Hi,
after you copy the above code to another study, and give it a name, say, myColoredDailySMA, replace the line in red with below line..should do the trick.. then add as many studies as you need SMA's to the chart.. use the built-in SMA for the non-colored SMA's (choose the color from study settings) and your new custom study for the colored ones..

hope this helps,
cheers,
RedK

 
Code
DailySMA.AssignValueColor(if DailySMA > DailySMA[1] then color.green else color.red);

Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #55 (permalink)
 
RedK's Avatar
 RedK 
Dubai, UAE
 
Experience: Intermediate
Platform: TOS, TradeStation
Broker: OX, TradeStation
Trading: Stocks & Basic Options
Posts: 171 since May 2012
Thanks Given: 44
Thanks Received: 145


pbenson68 View Post
In woodies Cci system there is 3 minute timer used to make trades. He uses 3 min bars. If the condition is met the trade is made with 20 secs left on the timer

When using tick aggregation, let's say 133 ticks per bar, a tick counter would let you know how many ticks were left before the bar closes, it could be used to pull the trigger if the condition looked for is met, for example early entry on cci breaking 45 after 100
Ticks

Here is link to someone who was searching for it on trade station
Tick Counter for Tradestation - TL - 3480

sorry if i can't help with that one.. tick charts = unchartered area for me..

Visit my NexusFi Trade Journal Reply With Quote
  #56 (permalink)
 Hguru 
New York City New York USA
 
Experience: Intermediate
Platform: Think or Swim, Infinity Futures
Broker: Thinkor Swim for Charts an Infinity Futures for Trading Dom
Trading: Oil
Posts: 54 since Jul 2012
Thanks Given: 449
Thanks Received: 48

RedK,

How can we make that colored SMA into an EMA the same way bldrmtnman Posted it.

Thanks

Hguru

Reply With Quote
  #57 (permalink)
 
RedK's Avatar
 RedK 
Dubai, UAE
 
Experience: Intermediate
Platform: TOS, TradeStation
Broker: OX, TradeStation
Trading: Stocks & Basic Options
Posts: 171 since May 2012
Thanks Given: 44
Thanks Received: 145


Hguru View Post
RedK,

How can we make that colored SMA into an EMA the same way bldrmtnman Posted it.
Thanks
Hguru

@Hguru,

all you need is a quick change of the average formula line into "expaverage" instead of the simple "average". i also changed the variable name to go with that..

sorry if i can't test this as you know but it should work.. paste the below code into a new study, and call it anything, like MyDailyEMA .. hope this works

 
Code
input price = FundamentalType.CLOSE;
input aggregationPeriod = AggregationPeriod.DAY;
input length = 9;
input displace = 0;
input showOnlyLastPeriod = no;

plot DailyEMA;

if showOnlyLastPeriod and !IsNaN(close(period = aggregationPeriod)[-1]) {
DailyEMA = Double.NaN;
} else {
DailyEMA = Expaverage(fundamental(price, period = aggregationPeriod)[-displace], length);
}

DailyEMA.AssignValueColor(if DailyEMA > DailyEMA[1] then color.green else color.red);
DailyEMA.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #58 (permalink)
 Hguru 
New York City New York USA
 
Experience: Intermediate
Platform: Think or Swim, Infinity Futures
Broker: Thinkor Swim for Charts an Infinity Futures for Trading Dom
Trading: Oil
Posts: 54 since Jul 2012
Thanks Given: 449
Thanks Received: 48

RedK,

I will check it out. I appreciate the effort. Got to keep those TOS programing juices flowing

Thanks

Hguru

Reply With Quote
  #59 (permalink)
 pbenson68 
San Diego CA
 
Experience: Beginner
Platform: TOS
Trading: StocKs
Posts: 26 since May 2012
Thanks Given: 14
Thanks Received: 5


RedK View Post
sorry if i can't help with that one.. tick charts = unchartered area for me..

No problem, there are bigger fish to fry I learned from this site that TOS has a lag, all my work is garbage if this can't be solved

Reply With Quote
  #60 (permalink)
bldrmtnman
Oakhurst CA USA
 
Posts: 3 since Jul 2012
Thanks Given: 3
Thanks Received: 1



RedK View Post
@Hguru,

all you need is a quick change of the average formula line into "expaverage" instead of the simple "average". i also changed the variable name to go with that..

sorry if i can't test this as you know but it should work.. paste the below code into a new study, and call it anything, like MyDailyEMA .. hope this works

 
Code
input price = FundamentalType.CLOSE;
input aggregationPeriod = AggregationPeriod.DAY;
input length = 9;
input displace = 0;
input showOnlyLastPeriod = no;

plot DailyEMA;

if showOnlyLastPeriod and !IsNaN(close(period = aggregationPeriod)[-1]) {
DailyEMA = Double.NaN;
} else {
DailyEMA = Expaverage(fundamental(price, period = aggregationPeriod)[-displace], length);
}

DailyEMA.AssignValueColor(if DailyEMA > DailyEMA[1] then color.green else color.red);
DailyEMA.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

RedK

Thanks for the effort to put up the code.
I wanted to change up the color, though I could go in and change the code for the color to a default, such as:

DailyEMA.AssignValueColor(if DailyEMA > DailyEMA[1] then dark_green else color. dark_red);

is there a simple way to make that a selectable color for the two colors? I find there is too much red and green employed elsewhere in the chart, so it makes the EMA too similar to other indicators, making it difficult to differentiate between them.

Reply With Quote




Last Updated on March 25, 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