Drawing parallel lines - Sierra Chart | futures io social day trading
futures io futures trading


Drawing parallel lines
Updated: Views / Replies:246 / 7
Created: by Grantx Attachments:0

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 100,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

 
 
Thread Tools
 

Drawing parallel lines

 
Legendary Guesser
Reading UK
 
Trading Experience: None
Platform: Prorealtime
Broker/Data: Interactive Brokers
Favorite Futures: My 3 boys
 
Grantx's Avatar
 
Posts: 1,584 since Oct 2016
Thanks: 2,185 given, 4,096 received

Drawing parallel lines

I have managed to draw a horizontal line using sc.UseTool and DRAWING_HORIZONTALLINE
Does anyone know how to draw 2 additional lines that mirror the first line - one being +50 ticks away and the other being -50 ticks away?

 
Code
#include "sierrachart.h"   
SCDLLName("Grantx Custom Study") 
SCSFExport scsf_TemplateFunction(SCStudyInterfaceRef sc) 
{ 
  // Section 1 - Set the configuration variables and defaults 
  		if (sc.SetDefaults)
	{
		sc.GraphName = "Stop and Loss range tool";
		sc.GraphRegion = 0;
		sc.AutoLoop = 0; //No automatic looping
		return;
	}
	// Do data processing	
	int BarIndex;
	int& r_DrawingLineNumber = sc.GetPersistentInt(1);
	if (r_DrawingLineNumber != 0 && sc.LastCallToFunction)
	{
		// Be sure to remove the Text drawing added as a user drawn drawing
		sc.DeleteUserDrawnACSDrawing(sc.ChartNumber, r_DrawingLineNumber);
		return;//No further processing needed in this case.
	}
	int& r_LineNumber = sc.GetPersistentInt(2);
	s_UseTool Tool;
	Tool.ChartNumber = sc.ChartNumber;
	Tool.DrawingType = DRAWING_HORIZONTALLINE;
	if (r_LineNumber != 0)
		Tool.LineNumber = r_LineNumber;
	// Must set user drawn flag
	Tool.AddAsUserDrawnDrawing = 1;
	Tool.BeginValue = 2875;
	Tool.Color = COLOR_KHAKI;
	Tool.AddMethod = UTAM_ADD_ONLY_IF_NEW;
	sc.UseTool(Tool);
	//Remember the line number which has been automatically assigned
	r_LineNumber = Tool.LineNumber;
	// If the user drawn line exists, we will add a message to the Message Log
	if (sc.UserDrawnChartDrawingExists(sc.ChartNumber, r_DrawingLineNumber))
	{
		sc.AddMessageToLog("User drawn Text exists.", 0);
	}
	if (sc.ChartDrawingExists(sc.ChartNumber, r_DrawingLineNumber))
	{
		sc.AddMessageToLog("Error: User drawn Text should not exist when calling the ChartDrawingExists().", 1);
	}
}

Visit my futures io Trade Journal
 
 
Columbus, OH
 
Trading Experience: Intermediate
Platform: SierraChart
Favorite Futures: CL
 
Posts: 30 since May 2013
Thanks: 126 given, 19 received

This may be a little easier to program via a subgraph study. Is there a reason you want to use the Tool function?

 
 
Legendary Guesser
Reading UK
 
Trading Experience: None
Platform: Prorealtime
Broker/Data: Interactive Brokers
Favorite Futures: My 3 boys
 
Grantx's Avatar
 
Posts: 1,584 since Oct 2016
Thanks: 2,185 given, 4,096 received



mkata View Post
This may be a little easier to program via a subgraph study. Is there a reason you want to use the Tool function?

Im adding it as a user drawn drawing so that I can drag it around the chart. I dont like the built in risk reward tool that Sierra has so I want to create my own.

Visit my futures io Trade Journal
 
 
Columbus, OH
 
Trading Experience: Intermediate
Platform: SierraChart
Favorite Futures: CL
 
Posts: 30 since May 2013
Thanks: 126 given, 19 received

Would you be open to using the already existing rectangle tool with the draw midline option checked?

 
 
Legendary Guesser
Reading UK
 
Trading Experience: None
Platform: Prorealtime
Broker/Data: Interactive Brokers
Favorite Futures: My 3 boys
 
Grantx's Avatar
 
Posts: 1,584 since Oct 2016
Thanks: 2,185 given, 4,096 received


mkata View Post
Would you be open to using the already existing rectangle tool with the draw midline option checked?

Needs to be adjustable entry, exit and target parameters. I tried implementing another sc.UseTool(Tool) instance but that didnt work. I dont know if you can add a bunch of different tools like 3 seperate horizontal lines and then just add them using the one sc.UseTool(Tool).

Problem is that I cant debug and step through the code. The help file is also a tsunami of confusing text written by a schizzo

Visit my futures io Trade Journal
 
 
Columbus, OH
 
Trading Experience: Intermediate
Platform: SierraChart
Favorite Futures: CL
 
Posts: 30 since May 2013
Thanks: 126 given, 19 received

For what you want to do your function would need to call 3 separate horizontal line tools. Easy enough. This is not the problem though.

The main problem is that they are not going to move as one unit that you can drag & drop around the screen.

Each drawing tool has built in levels that define that tool. the Horizontal Line Tool is built as a single line, therefore you
would need 3 separate UseTools. However even if you did this and gave them the same line number they still are not going to move
as a single unit, only one of the lines would move.

You are going to need to use another tool that has multiple levels built in. This will allow you to move the tool as one unit.
Based on your example, as long as your target and stop are equal distance the ideal candidate would be the parallel lines/rays with
one retracement level set at 50% (your entry level). Another candidate could be the rectangle tool with the midpoint checked.
Basically any tool that would provide multiple visual levels with a low, middle, high.

I suggest looking at and playing around with the parallel lines example.

 
 
Legendary Guesser
Reading UK
 
Trading Experience: None
Platform: Prorealtime
Broker/Data: Interactive Brokers
Favorite Futures: My 3 boys
 
Grantx's Avatar
 
Posts: 1,584 since Oct 2016
Thanks: 2,185 given, 4,096 received


mkata View Post
For what you want to do your function would need to call 3 separate horizontal line tools. Easy enough. This is not the problem though.

The main problem is that they are not going to move as one unit that you can drag & drop around the screen.

Each drawing tool has built in levels that define that tool. the Horizontal Line Tool is built as a single line, therefore you
would need 3 separate UseTools. However even if you did this and gave them the same line number they still are not going to move
as a single unit, only one of the lines would move.

You are going to need to use another tool that has multiple levels built in. This will allow you to move the tool as one unit.
Based on your example, as long as your target and stop are equal distance the ideal candidate would be the parallel lines/rays with
one retracement level set at 50% (your entry level). Another candidate could be the rectangle tool with the midpoint checked.
Basically any tool that would provide multiple visual levels with a low, middle, high.

I suggest looking at and playing around with the parallel lines example.

What if I added the first line at the last bar and then the other two lines reference that first one. It all depends if one tool can reference the price level of another tool.....surely? There is a built in study called "Study Subgraph Add" which does just this but how would I incorporate this into my code?

pseudo code:
EntryLinePrice = LastBarClosingPriceLevel;
TargetLinePrice = EntryLinePrice + 80 ticks;
StopLinePrice = EntryLinePrice - 50 ticks;

Ill try this and if it fails then the fib retrace or extension tool might do the job.

Visit my futures io Trade Journal
 
 
Columbus, OH
 
Trading Experience: Intermediate
Platform: SierraChart
Favorite Futures: CL
 
Posts: 30 since May 2013
Thanks: 126 given, 19 received


Grantx View Post
It all depends if one tool can reference the price level of another tool.....surely? There is a built in study called "Study Subgraph Add" which does just this but how would I incorporate this into my code?

You can have a Tool reference a subgraph drawing but the subgraph drawing is not available for drag & drop.

The following user says Thank You to mkata for this post:

 



futures io > > > > Drawing parallel lines
Thread Tools



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

futures io is celebrating 10-years w/ over $18,000 in prizes!

Right now
 

$1,000 in Amazon Gift Cards being given away right now from GFF Brokers

Right now
 

$250 Amazon Gift Cards with our "Thanks Contest" challenge!

Right now
 

Show us your trading desks and win over $5,000 in prizes w/Jigsaw Trading

August
 

Webinar: Chart Patterns and Practical Trading Stats w/Suri Duddella

Elite only
 

Webinar: Richard Bailey (TBA)

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Indicator to draw parallel lines to daily OHL Calming NinjaTrader 0 October 27th, 2018 04:00 AM
Parallel Lines DavidHP NinjaTrader Programming 5 August 18th, 2017 06:43 AM
Parallel Close Slopes stockgoblin NinjaTrader 0 March 24th, 2013 02:16 PM
Does anyone know of Clayburg's Breakout System with Parallel Function? testitest TradeStation 5 December 2nd, 2012 11:53 PM
Parallel optimization jjmmg NinjaTrader Programming 8 February 9th, 2011 12:01 PM


All times are GMT -4. The time now is 03:04 AM. (this page content is cached, log in for real-time version)

Copyright © 2019 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