Price Headley's Percent R Thinkscript study - ThinkOrSwim Programming | futures io social day trading

Price Headley's Percent R Thinkscript study
 Updated: May 22nd, 2013 (05:21 PM) Views / Replies: 2,822 / 1 Created: May 16th, 2013 (03:50 PM) by ikholobayev Attachments: 0

 Welcome to futures io.

Price Headley's Percent R Thinkscript study

Durham, NC, USA

Futures Experience: Intermediate
Platform: Thinkorswim
Favorite Futures: Stocks

Posts: 1 since May 2013

Price Headley's Percent R Thinkscript study

Hello,

I am a new member of this forum. I am trying to create a script based on Price Headley's %R method.

Here is the description of the method:

Williams %R is set to length = 30 days

When %R crosses above -20 that is considered a bullish setup bar.
The closing price of any one of the next five bars must close above the bullish setup bar's high. When that happens it is considered to be a favorable condition for a long entry.

Here is my script:

Code
 ```declare upper; def WR = WilliamsPercentR("length" = 30); def SetupBar = if WR crosses above -20 then high else double.NaN; plot ConfirmBar = close > SetupBar within 5 bars; ConfirmBar.SetPaintingStrategy(PaintingStrategy.Boolean_ARROW_UP); ConfirmBar.SetDefaultColor(GetColor(1)); ConfirmBar.SetLineWeight(1);```

The line highlighted in red doesn't work for some reason. I can overcome this with brute force by adding the following statements (but I don't like it very much):

Code
 ```declare upper; def WR = WilliamsPercentR("length" = 30); def SetupBar = if WR crosses above -20 then high else double.NaN; plot ConfirmBar1 = close > SetupBar[1]; plot ConfirmBar2 = close > SetupBar[2]; plot ConfirmBar3 = close > SetupBar[3]; plot ConfirmBar4 = close > SetupBar[4]; plot ConfirmBar5 = close > SetupBar[5]; ConfirmBar1.SetPaintingStrategy(PaintingStrategy.Boolean_ARROW_UP); ConfirmBar1.SetDefaultColor(GetColor(5)); ConfirmBar1.SetLineWeight(1); ConfirmBar2.SetPaintingStrategy(PaintingStrategy.Boolean_ARROW_UP); ConfirmBar2.SetDefaultColor(GetColor(5)); ConfirmBar2.SetLineWeight(1); ConfirmBar3.SetPaintingStrategy(PaintingStrategy.Boolean_ARROW_UP); ConfirmBar3.SetDefaultColor(GetColor(1)); ConfirmBar3.SetLineWeight(1); ConfirmBar4.SetPaintingStrategy(PaintingStrategy.Boolean_ARROW_UP); ConfirmBar4.SetDefaultColor(GetColor(1)); ConfirmBar4.SetLineWeight(1); ConfirmBar5.SetPaintingStrategy(PaintingStrategy.Boolean_ARROW_UP); ConfirmBar5.SetDefaultColor(GetColor(1)); ConfirmBar5.SetLineWeight(1);```

The brute force code results in multiple arrows appearing each time when a new bar makes a higher close in relation to the setup bar's high. I want the arrow to appear only once when that happens (be it on the 1st, 2nd ... 5th candle).

Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).

Last edited by ikholobayev; May 16th, 2013 at 04:17 PM.

Knowledge Seeker
Dubai, UAE

Futures Experience: Intermediate
Favorite Futures: Stocks & Basic Options

Posts: 171 since May 2012

I would do it like this.. it's not the optimum code but simple.. may inspire a different approach for you.. the entry level will be visually painted for you and you get a single arrow up (but for each new crossing though).
cheers, K

Code
 ```declare upper; def WR = WilliamsPercentR("length" = 30); plot SetupBar = WR crosses above -20 ; plot LongEntry = if SetupBar then high else if SetupBar[1] then high[1] else if SetupBar[2] then high[2] else if SetupBar[3] then high[3] else if SetupBar[4] then high[4] else double.NaN; LongEntry.setpaintingStrategy (paintingstrategy.DASHES); LongEntry.Setlineweight (2); LongEntry.setdefaultcolor(color.cyan); SetUpBar.SetPaintingStrategy(PaintingStrategy.Boolean_ARROW_UP); SetUpBar.SetDefaultColor(color.cyan); SetUpBar.SetLineWeight(1);```

 futures io > Price Headley's Percent R Thinkscript study

Upcoming Webinars and Events (4:30PM ET unless noted)

Elite only

Digging into the Details of iSystems w/Stage 5 & iSystems

Jun 5

 Similar Threads Thread Thread Starter Forum Replies Last Post Quick Summary News and Current Events 0 October 9th, 2012 02:20 PM TonyB ThinkOrSwim 0 March 4th, 2012 10:27 PM Jeff65 Emini Index Futures Trading 7 January 20th, 2012 10:38 PM Big Mike EasyLanguage Programming 5 April 18th, 2010 12:28 AM

All times are GMT -4. The time now is 07:28 PM.

 Copyright © 2018 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io 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.
no new posts
Page generated 2018-05-20 in 0.08 seconds with 19 queries on phoenix via your IP 54.158.194.80