Point and Figure for ToS - ThinkOrSwim Programming | futures io social day trading
futures io futures trading


Point and Figure for ToS
Updated: Views / Replies:12,474 / 10
Created: by cbritton Attachments:5

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors – all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you don’t need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

Reply
 5  
 
Thread Tools Search this Thread
 

Point and Figure for ToS

  #1 (permalink)
Elite Member
Atlanta, Georgia
 
Futures Experience: Intermediate
Platform: NT
Broker/Data: DDT
Favorite Futures: ZN, ZB
 
cbritton's Avatar
 
Posts: 224 since Mar 2010
Thanks: 152 given, 237 received

Point and Figure for ToS

This is a quick port of the point and figure indicator from easy language to ToS. This was done as a request. I'm not an expert on P&F charts and I don't use them.

Here's the EL code:

 
Code
                            
// PnF EasyLanguage code
// This will simulate "Point & Figure" levels on a bar chart
{Written by Adam Hefner version 01-07-02}

Var: 
dbh(0), dbl(0), {Daily block high/low}
abh(0), abl(0), {actual block high/low}
dir(0), {direction}
sv(0); {stop value}

inputs
 
BlockSize(1) , {Block Size}
 
ReverseSize3), {Reverse Size}
 
lookBack(-1) ; {look back period}

Var: 
 
bs(BlockSize) ,
 
rs(ReverseSize) ,
 
lb(LookBack) ;

 {
daily block high/low calculations}
If 
Round(high/bs0)*bs High
 then dbh 
= (Round(highbs,0)*bs) -bs
 
else dbh Round(high/bs0)*bs;

If 
Round(Low/bs0)*bs Low
then dbl 
= (Round(Low/bs0)*bs)+bs
else dbl Round(Low/bs0)*bs;

If 
currentbar <= {check for first 2 bars of the chartthen begin
    dir 
1;
    
abh dbh;
    
abl dbl;
end else begin

If dir[1] = {direction up calculationsthen begin
    
if dbh abh[1then
        abh 
dbh {new high}
    else 
begin
        
If dbl <= abh-(bs*rs) {reversethen begin
            dir 
= -1;
            
abh abh[1];
            
abl dbl;
        
end else
            
abh abh[1];
    
end;
end else begin {direction down calculations}
    If 
dbl abl[1then
       abl 
dbl {new low}
    else if 
dbh >= abl+(bs*rs) {reversethen begin
        dir 
1;
        
abl abl[1];
        
abh dbh;
    
end else
        
abl abl[1];
end;
end;
        
If 
dir {reversal stop}
then sv abh-(bs*rs)
else 
sv abl+(bs*rs);
    
plot1(abh);
plot2(abl);
plot3[lb](sv) ; 
Here's the ToS code:

 
Code
                            
input blockSize 1;
input reverseSize 3;
input lookBack 1;

# daily block high/low calculations

rec dbh = if round(high/blockSize0)*blockSize high then (round(high/blockSize,0)*blockSize) - blockSize else round(high/blockSize,0)*blockSize;

rec dbl = if round(low/blockSize0)*blockSize low then (round(low/blockSize,0)*blockSize) + blockSize else round(low/blockSize,0)*blockSize;

rec dir compoundValue(1, if dir[1] == and dbh <=  dbh-(blockSize*reverseSizethen -else if dir[1] != and dbh >= dbl+(blockSize*reverseSizethen 1 else dir[1],1);

rec abh compoundValue(1, if dir[1] == and dbh abh[1then dbh else if dir[1] == and dbh <= abh[1then abh[1] else if dir[1] != and dbh >= dbl+(blockSize*reverseSizethen dbh else abh[1], dbh);

rec abl compoundValue(1, if dir[1] == and dbh <= abh[1] and dbl <= abh-(blockSize*reverseSizethen dbl else if dir[1] != and dbl abl[1then dbl else if dir[1] != and dbh dbl+(blockSize*reverseSizethen abl[1] else abl[1], dbl);

rec sv = if dir == 1 then abh-(blockSize*reverseSize) else abl+(blockSize*reverseSize);

plot a abh;
plot b abl;

plot s sv[lookback]; 
Included is screenshot of a chart in ToS.

I think I got it to match the EL code. I will have to compare it to the TS version later when I have a minute, but anyone can take a stab at improving it.

Regards,
-C

“Strategy without tactics is the slowest route to victory. Tactics without strategy is the noise before defeat.” - Sun Tzu
Attached Thumbnails
Point and Figure for ToS-pf1.png  
Reply With Quote
 
  #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.

 
  #3 (permalink)
Trading for Profit
Chicago + Illinois/USA
 
Futures Experience: Beginner
Platform: ThinkOrSwim
Favorite Futures: Stock
 
StockJock's Avatar
 
Posts: 256 since Aug 2010
Thanks: 15 given, 148 received

Point and Figure for ToS


It appears that the translation only plots the upper and lower limits. I've been think that it might be possible to improvise with the plotting of Xs and Os by using the addChartBubble command, because its syntax is addChartBubble(x-axis location,y-axis location, text, color,up).

If it were possible to identify the x & y coordinates to place the bubbles then a PnF chart in TOS might be possible. The X-Axis consists of either bars or time; whereas the Y-Axis consists of prices. The horizontal limit is the aggregated time period and the vertical limit is the highesthigh and lowestlow prices. I'm working on it. If you have any suggestions, please let me know. The bubbles could be like this:

addChartBubble(x-axis location, y-axis location, "X", color.green, up)
addChartBubble(x-axis location, y-axis location, "O", color.red, down)

Reply With Quote
 
  #4 (permalink)
Trading for Profit
Chicago + Illinois/USA
 
Futures Experience: Beginner
Platform: ThinkOrSwim
Favorite Futures: Stock
 
StockJock's Avatar
 
Posts: 256 since Aug 2010
Thanks: 15 given, 148 received

I've developed some starter code for a Point & Figure indicator (PnF), but I need some help. The code shows the closing prices of each bar on the chart and an index number for each bar.

1. How can I start a calculation from the far left of the chart to progressively calculate the PnF value; since normally TOS counts from the right side of the chart?

2. Is there a way to total the bar count and use the bar index to use the fold command to do the iterations?

3. This code displays the number of each bar; but how can I use that number in the bar index (i.e. close[#])?

 
Code
declare upper; 
 
# Clear Chart
AssignPriceColor(CreateColor(10, 0, 78));
AssignBackgroundColor(CreateColor(10, 0, 78));
 
# Graph Boundaries
plot HH = HighestAll(high);
plot LL = LowestAll(low);
plot ML = (HH + LL) / 2;
 
# Plot Bubbles
def Bar_Xaxis = barNumber();
def Bar_Yaxis = ML;
rec BarIndex = if IsNaN( BarIndex[1] ) then 0 else BarIndex[1] + 1;
AddChartBubble(Bar_Xaxis, Bar_Yaxis, concat("", BarIndex), color.Gray, No); 
AddChartBubble(Bar_Xaxis, Bar_Yaxis, concat("", close[0]), color.Cyan, Yes);
Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).


Last edited by StockJock; September 19th, 2010 at 02:28 PM.
Reply With Quote
 
  #5 (permalink)
Trading for Profit
Chicago + Illinois/USA
 
Futures Experience: Beginner
Platform: ThinkOrSwim
Favorite Futures: Stock
 
StockJock's Avatar
 
Posts: 256 since Aug 2010
Thanks: 15 given, 148 received

Plotting Prices & Indexes On Price Bars

This code is to start the bar count from the first bar on the far left side of the chart and count down forward in time. I'm trying to use the fold statement to do a count down, but fold is so different from loops in other programming languages. I need help on this. Has anyone else used the fold statement?
=================================================
declare upper;
# Clear Chart
AssignPriceColor(CreateColor(10, 0, 78));
AssignBackgroundColor(CreateColor(10, 0, 78));
# Graph Boundaries
plot HH = HighestAll(high);
plot LL = LowestAll(low);
plot ML = (HH + LL) / 2;
# Plot Bubbles
def TotalBarsOnChart=24*60*60 *1000/getAggregationPeriod();
def Bar_Xaxis = barNumber();
def Bar_Yaxis = ML;
rec FBarIndex = if IsNaN(FBarIndex[1] ) then 0 else FBarIndex[1] + 1;
rec RBarIndex=fold index = 1 to TotalBarsOnChart with Bar = TotalBarsOnChart do Bar = Bar - 1);

AddChartBubble(Bar_Xaxis, Bar_Yaxis, concat("", FBarIndex), color.Gray, No);
AddChartBubble(Bar_Xaxis, Bar_Yaxis + 0.2, concat("", RBarIndex), color.Yellow, No);
========================= ========================

Reply With Quote
 
  #6 (permalink)
Trading for Profit
Chicago + Illinois/USA
 
Futures Experience: Beginner
Platform: ThinkOrSwim
Favorite Futures: Stock
 
StockJock's Avatar
 
Posts: 256 since Aug 2010
Thanks: 15 given, 148 received

Three Line Break

I don't seem to have much luck developing a PnF indicator in ThinkScript, but I've found out that the Three Line Break chart does something similar. If its not too much trouble, could someone translate this EasyLanguage code into ThinkScript?

Here is the Easy Language version:
 
Code
 
Variables: 
FUBarHigh(0), 
FUBarLow(0), 
SUBarHigh(0), 
SUBarLow(0),
TUBarHigh(0), 
TUBarLow(0), 
FLBarHigh(0), 
FLBarLow(0), 
SLBarHigh(0),
SLBarLow(0), 
TLBarHigh(0), 
TLBarLow(0), 
UpCount(0), 
DownCount(0),
UpNew(0), 
DnNew(0), 
UpRev(0), 
DnRev(0), 
PlotHigh(0),
PlotLow(0), 
Color(0);
If Close > UpNew Then Begin
If DownCount < 3 Then Begin
If UpCount = 0 Then Begin
UpCount = UpCount + 1;
DownCount = 0;
FUBarHigh = Close;
FUBarLow = UpNew;
SUBarHigh = 0;
SUBarLow = 0;
TUBarHigh = 0;
TUBarLow = 0;
FLBarHigh = 0;
FLBarLow = 0;
SLBarHigh = 0;
SLBarLow = 0;
TLBarHigh = 0;
TLBarLow = 0;
UpNew = FUBarHigh;
DnNew = FUBarLow;
PlotHigh = FUBarHigh;
PlotLow = FUBarLow; 
Color = 7;
End;
If UpCount = 1 Then
If Close > UpNew Then Begin
UpCount = UpCount + 1;
SUBarHigh = Close;
SUBarLow = FUBarHigh;
UpNew = SUBarHigh;
DnNew = SUBarLow;
PlotHigh = SUBarHigh;
PlotLow = SUBarLow;
Color = 8;
End;
If UpCount = 2 Then
If Close > UpNew Then Begin
UpCount = UpCount + 1;
TUBarHigh = Close;
TUBarLow = SUBarHigh;
UpNew = TUBarHigh;
DnNew = TUBarLow;
PlotHigh = TUBarHigh;
PlotLow = TUBarLow;
Color = 7;
End;
If UpCount = 3 Then
If Close > UpNew Then Begin
FUBarHigh = SUBarHigh;
FUBarLow = SUBarLow;
SUBarHigh = TUBarHigh;
SUBarLow = TUBarLow;
TUBarHigh = Close;
TUBarLow = SUBarHigh;
UpNew = TUBarHigh;
DnNew = TUBarLow;
PlotHigh = TUBarHigh;
PlotLow = TUBarLow;
If Color = 7 Then
Color = 8
Else
Color = 7;
End;
End;
If DownCount = 3 Then Begin
UpRev = FLBarHigh; 
If Close > UpRev Then Begin 
UpCount = UpCount + 1;
DownCount = 0;
FUBarHigh = Close; 
FUBarLow = TLBarHigh; 
SUBarHigh = 0;
SUBarLow = 0;
TUBarHigh = 0;
TUBarLow = 0;
FLBarHigh = 0;
FLBarLow = 0;
SLBarHigh = 0;
SLBarLow = 0;
TLBarHigh = 0;
TLBarLow = 0;
UpNew = FUBarHigh;
DnNew = FUBarLow;
PlotHigh = FUBarHigh;
PlotLow = FUBarLow; 
Color = 7;
End;
End;
End;
If Close < DnNew Then Begin
If UpCount < 3 Then Begin
If DownCount = 0 Then Begin
DownCount = DownCount + 1;
UpCount = 0; 
FLBarHigh = DnNew;
FLBarLow = Close;
SLBarHigh = 0;
SLBarLow = 0;
TLBarHigh = 0;
TLBarLow = 0;
FUBarHigh = 0;
FUBarLow = 0;
SUBarHigh = 0;
SUBarLow = 0;
TUBarHigh = 0;
TUBarLow = 0;
UpNew = FLBarHigh;
DnNew = FLBarLow;
PlotHigh = FLBarHigh;
PlotLow = FLBarLow;
Color = 6; 
End;
If DownCount = 1 Then
If Close < DnNew Then Begin
DownCount = DownCount + 1;
SLBarHigh = FLBarLow;
SLBarLow = Close;
UpNew = SLBarHigh;
DnNew = SLBarLow;
PlotHigh = SLBarHigh;
PlotLow = SLbarLow;
Color = 5;
End;
If DownCount = 2 Then
If Close < DnNew Then Begin
DownCount = DownCount + 1;
TLBarHigh = SLBarLow;
TLBarLow = Close;
UpNew = TLBarHigh;
DnNew = TLBarLow;
PlotHigh = TLBarHigh;
PlotLow = TLBarLow;
Color = 6;
End;
If DownCount = 3 Then
If Close < DnNew Then Begin
FLBarHigh = SLBarHigh;
FLBarLow = SLBarLow;
SLBarHigh = TLBarHigh;
SLBarLow = TLBarLow;
TLBarHigh = SLBarLow;
TLBarLow = Close;
UpNew = TLBarHigh;
DnNew = TLBarLow;
PlotHigh = TLBarHigh;
PlotLow = TLBarLow;
If Color = 6 Then
Color = 5
Else
Color = 6;
End;
End;
If UpCount = 3 Then Begin
DnRev = FUBarLow; 
If Close < DnRev Then Begin 
DownCount = DownCount + 1;
UpCount = 0;
FLBarHigh = TUBarLow;
FLBarLow = Close; 
SLBarHigh = 0;
SLBarLow = 0;
TLBarHigh = 0;
TLBarLow = 0;
FUBarHigh = 0;
FUBarLow = 0;
SUBarHigh = 0;
SUBarLow = 0;
TUBarHigh = 0;
TUBarLow = 0;
UpNew = FLBarHigh;
DnNew = FLBarLow;
PlotHigh = FLBarHigh;
PlotLow = FLBarLow;
Color = 6;
End;
End;
End; Plot1(PlotHigh,"High Bar",Color);
Plot2(PlotLow,"Low Bar",Color);
Also there's another EL code version for the Three Line Break at:
Part 1: Three Line Break | TradeStation EasyLanguage
Part 2: Three Line Break | TradeStation EasyLanguage
Part 3: Three Line Break | Tradestation EasyLanguage
Part 4: Three Line Break | Tradestation EasyLanguage


Last edited by StockJock; December 7th, 2010 at 12:46 PM.
Reply With Quote
 
  #7 (permalink)
Elite Member
Glyndon, Maryland, USA
 
Futures Experience: Advanced
Platform: TOS
Favorite Futures: options
 
Posts: 24 since Sep 2010
Thanks: 6 given, 47 received

If you post a screenshot I will tell you how to fix it without any problem.

Reply With Quote
 
  #8 (permalink)
Trading for Profit
Chicago + Illinois/USA
 
Futures Experience: Beginner
Platform: ThinkOrSwim
Favorite Futures: Stock
 
StockJock's Avatar
 
Posts: 256 since Aug 2010
Thanks: 15 given, 148 received

optntdr13,

What elof and I are trying to do is to develop code for a PnF chart for the ThinkOrSwim trading platform. The screenshot that you're referring to is in this thread in post #4 and it does work; so I don't know why elof is having a problem with it. It is only a starter code to attempt to build a PnF code. It is not a finished PnF code.

I see that your Trading Experience is Advanced and if your ThinkScript programming experienced is advanced also, I would appreciate your help. I've come across a very good working code that is coded for the Amibroker platform and if this could be translated into a working TOS code, we would greatly appreciate it. I've attached the Amibroker PnF chart code as a text file together with a screen shot showing its capability.

On issue with PnF chart code is that it should be able to display Xs and Os in the same column for the Wyckoff trading system only when the settings are a box size of 1 and a reversal size of 1. For all other settings, the Xs and Os should be in seperate columns. The attached code doesn't do that and I'm still looking for code that will do it so that it could be translated into TOS. Your help with this is appreciated.

I've also attached the Amibroker User's Guide that contains instructions for the Amibroker Formula Language (AFL).

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

Attached Thumbnails
Point and Figure for ToS-usersguide.pdf  
Attached Files
Register to download File Type: txt PnF & Values-SJ.txt (6.3 KB, 128 views)

Last edited by StockJock; January 25th, 2011 at 11:45 AM.
Reply With Quote
The following user says Thank You to StockJock for this post:
 
  #9 (permalink)
Trading Apprentice
chicago, il
 
Futures Experience: Intermediate
Platform: ThinkOrSwim
Favorite Futures: Stocks
 
Posts: 2 since Jun 2014
Thanks: 0 given, 0 received

So, I take it that nobody was ever able to figure this out for ThinkOrSwim.
I am just starting with ToS and really miss this wonderful charting technique.

Reply With Quote
 
  #10 (permalink)
Trading Apprentice
chicago, il
 
Futures Experience: Intermediate
Platform: ThinkOrSwim
Favorite Futures: Stocks
 
Posts: 2 since Jun 2014
Thanks: 0 given, 0 received


The lookBack is coded wrong in this example. Instead of 1, it should be -1.

Reply With Quote

Reply



futures io > > > > > Point and Figure for ToS

Thread Tools Search this Thread
Search this Thread:

Advanced Search



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

Linda Bradford Raschke: Reading The Tape

Elite only

Adam Grimes: TBA

Elite only

NinjaTrader: TBA

January

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Point and Figure Charts Chipmunk NinjaTrader 9 April 25th, 2016 01:18 PM
Point and Figure for NinjaTrader max-td NinjaTrader 9 September 10th, 2014 10:51 AM
Point And Figure for ninja6.5 Zsolt NinjaTrader Programming 3 September 21st, 2010 09:27 AM
Is there any NT indicator can show volatility like BigMike's figure owen NinjaTrader Programming 3 May 17th, 2010 04:42 AM
how many traders trade with point & figure charts- carlos Traders Hideout 3 April 24th, 2010 11:05 PM


All times are GMT -4. The time now is 04:02 PM.

Copyright © 2017 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 2017-12-12 in 0.14 seconds with 20 queries on phoenix via your IP 54.163.210.170