NexusFi: Find Your Edge


Home Menu

 





Turning an indicator into a strategy


Discussion in EasyLanguage Programming

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




 
Search this Thread

Turning an indicator into a strategy

  #1 (permalink)
w4rri0r
world's citizen
 
Posts: 45 since Oct 2015
Thanks Given: 10
Thanks Received: 7

Hi forumer,
i've found this linear regression indicator and would turn it into a strategy

 
Code
inputs:
	Price( Close),
	Length( 20),
	Displace( 0),
	UpColor( green),
	UpDotColor (green),
	DnColor (red),
	DnDotColor (red),
	BarOffset (.02),
	DotInLine("No"),
	PaintInBarLRCLine ("Yes");

variables:
	LinReg( 0 ), Trend (0), Transition (0) ;

if Displace >= 0 or CurrentBar > AbsValue( Displace ) then 
	begin
	LinReg = LinearRegValue( Price, Length, 0 ) ; 
	If LinReg > LinReg [1] then
	  Begin
	  If Trend = -1 then Transition = 1;
	  If PaintInBarLRCLine = "Yes" then Plot1[Displace]( LinReg, "LinReg", UpColor );
	  If DotInline <> "Yes" then Plot3[Displace] (High + BarOffset,"Up",UpColor);
	  Trend = 1;
	  End
	Else
	  Begin
	  If Trend = 1 then Transition = 1;
	  If PaintInBarLRCLine = "Yes" then Plot1 [Displace] ( LinReg, "LinReg",DnColor ) ;
	  If DotInLine <> "Yes" then Plot4 [Displace] (Low - BarOffset,"Dn",DnColor);
	  Trend = -1;
	  End;
	  
If Transition = 1 then
Begin
  If Trend = 1 then 
  Begin 
    If DotInLine = "Yes" then
      Plot5[Displace]( LinReg, "UpDotColor", UpDotColor )
    else
      Plot5(High +  BarOffset, "UpDotColor", UpDotColor);
    Alert; 
  End;
  If Trend = -1 then 
  Begin
    If DotInLine = "Yes" then
      Plot6 [Displace] ( LinReg, "DnDotColor", DnDotColor ) 
    else
      Plot6(Low - BarOffset, "DnDotColor", DnDotColor);
    Alert;
  End;
  Transition = Transition + 1;
End;	  
	
	{ Alert criteria }
	if Displace <= 0 then 
		begin
		if Price > LinReg and LinReg > LinReg[1] and LinReg[1] <= LinReg[2] then
			Alert( "LRC turning up" )
		else if Price < LinReg and LinReg < LinReg[1] and LinReg[1] >= LinReg[2] then
			Alert( "LRC turning down" );	
		end ;
	end ;
anyone can help me?
thanks

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Better Renko Gaps
The Elite Circle
REcommedations for programming help
Sierra Chart
How to apply profiles
Traders Hideout
About a successful futures trader who didnt know anythin …
Psychology and Money Management
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
 
  #3 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,436 since Apr 2013
Thanks Given: 482
Thanks Received: 1,629


w4rri0r,

the first thing you would need to clarify is what exactly should trigger an entry and exits. Posting a couple of screenshots with the indicator and where you would want to see entries and exits might enable others to help you.

Regards,

ABCTG

Follow me on Twitter Reply With Quote
  #4 (permalink)
w4rri0r
world's citizen
 
Posts: 45 since Oct 2015
Thanks Given: 10
Thanks Received: 7


ABCTG View Post
w4rri0r,

the first thing you would need to clarify is what exactly should trigger an entry and exits. Posting a couple of screenshots with the indicator and where you would want to see entries and exits might enable others to help you.

Regards,

ABCTG

Hi ABCTG,
for testing purpose i simply need to buy/sell when the indicator turns up or down
it would be nice to insert a sort of delay bars to trigger the order or something like angle conditions



thanks

Reply With Quote




Last Updated on November 24, 2017


© 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