How to program a slope line breakout in EasyLanguage? - futures io
futures io



How to program a slope line breakout in EasyLanguage?


Discussion in EasyLanguage Programming

Updated
    1. trending_up 478 views
    2. thumb_up 1 thanks given
    3. group 2 followers
    1. forum 1 posts
    2. attach_file 1 attachments




Welcome to futures io: the largest futures trading community on the planet, with well over 125,000 members
  • Genuine reviews from real traders, not fake reviews from stealth vendors
  • Quality education from leading professional traders
  • We are a friendly, helpful, and positive community
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts
  • We are here to help, just let us know what you need
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

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

 
Search this Thread
 

How to program a slope line breakout in EasyLanguage?

(login for full post details)
  #1 (permalink)
MasterYan
San Francisco, CA
 
 
Posts: 24 since Jul 2016
Thanks: 10 given, 4 received

?

How to program a slope line breakout in EasyLanguage?

Is there a way to draw slope lines automatically similar how people do it manually?

Reply With Quote

Can you help answer these questions
from other members on futures io?
Simple code to end my indicator
NinjaTrader
RangeRider for NT8 V10
The Elite Circle
How to Register my Company in this Platform
Stocks and ETFs
Alternative to Mcginley Dynamic MA
Sierra Chart
Tradestation 10 work offline
TradeStation
 
Best Threads (Most Thanked)
in the last 7 days on futures io
Vinny E-Mini & Algobox Review TRADE ROOM
281 thanks
Would you share your Holy Grail?
83 thanks
EURUSD M6E/6E Euro
63 thanks
Spoo-nalysis ES e-mini futures S&P 500
47 thanks
TST/OneUp/LeeLoo/Earn2Trade
17 thanks
 
(login for full post details)
  #2 (permalink)
 ShadowFox 
CO/USA
 
Experience: Intermediate
Platform: TradeStation, Multicharts
Trading: Stocks, Futures
 
ShadowFox's Avatar
 
Posts: 97 since Jun 2020
Thanks: 60 given, 134 received

Alright I will give this one away. I don't use this anymore. Lookback length is the period you want to look back for the trendline, leftstrength, rightstrength define the bars left and bars right that you want to define a Higher or lower high or higher/lower low. DownLineCurrentPrice and UpLineCurrentPrice are the current bars trendline values if you want to check for price crossing. Excuse the hack job as I have not cleaned this code up or looked at it in a few years.

If you want to run this on daily bars or not have the trendline reset after the day close, remove the reset code if date <> date[1] code. Remove the whole if statement until the next end;

 
Code
inputs:  
	LeftStrength( 10 ) ,  
	RightStrength( 10 ), 
	LookBackLength( 100 );
 
variable:  
	ID(-1), 
	Offset( 0 ) , 
	HighValue1(0),
	HighValue2(0),
	LowValue1(0),
	LowValue2(0),
	
	DownStartPrice(0),
	DownStartBar(0),
	DownSecondPrice(0),
	DownTrendConfirmBar(0),
	DownTrendConfirm(0),
	DownSecondStartBar(0),
	DownLineCurrentPrice(0),
	
	UpStartPrice(0),
	UpStartBar(0),
	UpSecondPrice(0),
	UpTrendConfirmBar(0),
	UpTrendConfirm(0),
	UpSecondStartBar(0),
	UpLineCurrentPrice(0);

if Date <> Date[1] then begin
	HighValue1 = 0;
	HighValue2 = 0;
	LowValue1 = 0;
	LowValue2 = 0;
	
	DownStartPrice = 0;
	DownStartBar = 0;
	DownSecondPrice = 0;
	DownTrendConfirmBar = 0;
	DownTrendConfirm = 0;
	DownSecondStartBar = 0;
	DownLineCurrentPrice = 0;
	
	UpStartPrice = 0;
	UpStartBar = 0;
	UpSecondPrice = 0;
	UpTrendConfirmBar = 0;
	UpTrendConfirm = 0;
	UpSecondStartBar = 0;
	UpLineCurrentPrice = 0;
	end;

 
Offset = .15 * Average( Range, 5 ) ; 
 
if PivotHighVSBar( 1, High, LeftStrength, RightStrength, RightStrength + 1 ) <> -1 then 
begin 
	HighValue1 = PivotHighVS(1, High, Leftstrength, RightStrength, LookBackLength );  
	HighValue2 = PivotHighVS(2, High, Leftstrength, RightStrength, LookBackLength );  
 
	if HighValue2 <> -1 and ( ( HighValue1 >= HighValue2 - Offset ) and ( HighValue1 <= HighValue2 + Offset ) ) then  
	begin 
		//ID = Text_New(Date[RightStrength], Time[RightStrength], High[RightStrength] + Offset, "DT");  
		//Text_SetStyle(ID, 2, 1 ) ; 
		//Text_SetColor(ID, yellow);
		if DownTrendConfirm = 0 then begin
			DownSecondPrice = High[RightStrength];
			DownTrendConfirmBar = DownStartBar;
			DownSecondStartBar = RightStrength - 1;
			end
		else if DownTrendConfirm = 1 and High[RightStrength] > DownLineCurrentPrice then begin
			DownSecondPrice = High[RightStrength];
			DownTrendConfirmBar = DownStartBar;
			DownSecondStartBar = RightStrength - 1;
		end;		
		Value1 = 1;
	end ;  

	if HighValue2 <> -1 and HighValue1 > HighValue2 and value1 = 0 then  
	begin 
		//ID = Text_New(Date[RightStrength], Time[RightStrength], High[RightStrength] + Offset, "HH");  
		//Text_SetStyle(ID, 2, 1 ) ; 
		//Text_SetColor(ID, darkgreen);
		DownStartPrice = High[RightStrength];
		DownStartBar = RightStrength - 1;
	end 
	else 
	if HighValue2 <> -1 and HighValue1 < HighValue2 and value1 = 0 then
	begin
		//ID = Text_New(Date[RightStrength], Time[Rightstrength], High[RightStrength] + Offset, "(LH)");
		//Text_SetStyle(ID, 2, 1 ) ;
		//Text_SetColor(ID, Red);
		if DownTrendConfirm = 0 then begin
			DownSecondPrice = High[RightStrength];
			DownTrendConfirmBar = DownStartBar;
			DownSecondStartBar = RightStrength - 1;
			end
		else if DownTrendConfirm = 1 and High[RightStrength] > DownLineCurrentPrice then begin
			DownSecondPrice = High[RightStrength];
			DownTrendConfirmBar = DownStartBar;
			DownSecondStartBar = RightStrength - 1;
		end;		
		Value1 = 1;
	end ;
	Value1 = 0;
end ; 
 
if PivotLowVSBar( 1, Low, LeftStrength, RightStrength, RightStrength + 1 ) <> -1 then 
begin 
	LowValue1 = PivotLowVS(1, Low, Leftstrength, RightStrength, LookBackLength );  
	LowValue2 = PivotLowVS(2, Low, Leftstrength, RightStrength, LookBackLength );  
 
	if LowValue2 <> -1 and ( ( LowValue1 >= LowValue2 - Offset ) and ( LowValue1 <= LowValue2 + Offset ) ) then  
	begin 
		//ID = Text_New(Date[RightStrength], Time[RightStrength], Low[RightStrength] - Offset, "DB");  
		//Text_SetStyle(ID, 2, 0 ) ; 
		//Text_SetColor(ID, yellow);
		if UpTrendConfirm = 0 then begin
			UpSecondPrice = Low[RightStrength];
			UpTrendConfirmBar = UpStartBar;
			UpSecondStartBar = RightStrength - 1;
			End
		else if UpTrendConfirm = 1 and Low[RightStrength] < UpLineCurrentPrice then Begin
			UpSecondPrice = Low[RightStrength];
			UpTrendConfirmBar = UpStartBar;
			UpSecondStartBar = RightStrength - 1;
		End;
		Value1 = 1;
	end;  

	if LowValue2 <> -1 and LowValue1 < LowValue2 and Value1 = 0 then  
	begin  
		//ID = Text_New(Date[RightStrength], Time[RightStrength], Low[RightStrength] - Offset, "LL");  
		//Text_SetStyle(ID, 2, 0 ) ; 
		//Text_SetColor(ID, Red);
		UpStartPrice = Low[RightStrength];
		UpStartBar = RightStrength - 1;
	end 
	else 
	
	if LowValue2 <> -1 and LowValue1 > LowValue2 and Value1 = 0 then
	begin
		//ID = Text_New(Date[RightStrength], Time[RightStrength], Low[RightStrength] - Offset, "(HL)");
		//Text_SetStyle(ID, 2, 0 ) ;
		//Text_SetColor(ID, darkgreen);
		if UpTrendConfirm = 0 then begin
			UpSecondPrice = Low[RightStrength];
			UpTrendConfirmBar = UpStartBar;
			UpSecondStartBar = RightStrength - 1;
			End
		else if UpTrendConfirm = 1 and Low[RightStrength] < UpLineCurrentPrice then Begin
			UpSecondPrice = Low[RightStrength];
			UpTrendConfirmBar = UpStartBar;
			UpSecondStartBar = RightStrength - 1;
		End;
	end;
	Value1 = 0;
end ; 

//Down Trend
If DownStartBar >= RightStrength - 1
Then DownStartBar = DownStartBar + 1;

If DownTrendConfirmBar >= RightStrength - 1
Then DownTrendConfirmBar = DownTrendConfirmBar + 1;

If DownSecondStartBar >= RightStrength - 1
Then DownSecondStartBar = DownSecondStartBar + 1;

If DownStartBar = DownTrendConfirmBar Then
DownTrendConfirm = 1
Else DownTrendConfirm = 0;

If DownTrendConfirm = 1 Then
DownLineCurrentPrice = DownSecondPrice - (DownStartPrice - DownSecondPrice) 
			/ (IFF(DownStartBar - DownSecondStartBar <> 0,DownStartBar - DownSecondStartBar, 1)) 
			* DownSecondStartBar
Else begin 
	DownLineCurrentPrice = 0;
	SetPlotColor[1]( 1, Transparent );
	end;

//UpTrend
If UpStartBar >= RightStrength - 1
Then UpStartBar = UpStartBar + 1;

If UpTrendConfirmBar >= RightStrength - 1
Then UpTrendConfirmBar = UpTrendConfirmBar + 1;

If UpSecondStartBar >= RightStrength - 1
Then UpSecondStartBar = UpSecondStartBar + 1;

If UpStartBar = UpTrendConfirmBar Then
UpTrendConfirm = 1
Else UpTrendConfirm = 0;

If UpTrendConfirm = 1 Then
UpLineCurrentPrice = UpSecondPrice - (UpStartPrice - UpSecondPrice) 
			/ (IFF(UpStartBar - UpSecondStartBar <> 0,UpStartBar - UpSecondStartBar, 1)) 
			* UpSecondStartBar
Else begin 
	UpLineCurrentPrice = 0;
	SetPlotColor[1]( 2, Transparent );
	end;


If DownTrendConfirm = 1 Then
Plot1(DownLineCurrentPrice, !("Down Trend Price") );

If UpTrendConfirm = 1 Then
Plot2(UpLineCurrentPrice, !("Up Trend Price") );

Visit my futures io Trade Journal Reply With Quote
The following user says Thank You to ShadowFox for this post:


futures io Trading Community Platforms and Indicators EasyLanguage Programming > How to program a slope line breakout in EasyLanguage?


Last Updated on September 30, 2021


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing
     



Copyright © 2021 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada), 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