NexusFi: Find Your Edge


Home Menu

 





Need some guidance with the ATR Trailing LX(SX) signal of MC


Discussion in MultiCharts

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




 
Search this Thread
  #1 (permalink)
 my2108 
Kowloon, Hong Kong
 
Experience: Advanced
Platform: MC
Broker: IB
Trading: HSI
Posts: 17 since Aug 2018
Thanks Given: 3
Thanks Received: 3

HI all,
I get very confused with the signal when the marketing position is not 1 or -1..i.e. with flat position, don't understand why the line after else goes like
 
Code
Sell ( "AtrLX-eb" ) next bar at High - var0 stop
, the position is flat, what is it for SELL? Likewise in the ATR Trialing SX coding what is it for BuytoCover?

I am trying to use this signal to exit in my HSI trading algo, and it always cause the buy and sell to happen within the same bar.

Hope someone experienced with this signal can give me some guidance.

Thanks

=====================
[IntrabarOrderGeneration = false]
inputs: ATRLength( 10 ), NumATRs( 3 ) ;
variables: var0( 0 ), var1( 0 ), var2( 0 ) ;

var0 = AvgTrueRange( ATRLength ) * NumATRs ;
var1 = MarketPosition ;

if var1 = 1 then
begin
condition1 = var1[1] <> 1 or High > var2 ;
if condition1 then
var2 = High ;
Sell ( "AtrLX" ) next bar at var2 - var0 stop ;
end
else
Sell ( "AtrLX-eb" ) next bar at High - var0 stop ;

Follow me on Twitter Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
How to: Multi Time-Frame Volume Profile?
NinjaTrader
Need help updating setting in RSqueeze indicator for Nin …
Platforms and Indicators
Creating global variables for Ninjatrader
Traders Hideout
DOM in QTrader vs Bookmap
Platforms and Indicators
RSI Values Scale
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Fighting Addiction and Stops
17 thanks
Just another trading journal: PA, Wyckoff & Trends
6 thanks
Big Mike in Ecuador
6 thanks
Crossing the Abyss: An Adventure Guide by Snax
4 thanks
Want your NinjaTrader indicator created, free?
4 thanks
  #2 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,441 since Apr 2013
Thanks Given: 491
Thanks Received: 1,634

my2108,

in Multicharts PowerLanguage "Sell" refers to exiting a long position and "BuyToCover" is the cover of a short position.

The code you posted checks for the MarketPosition being 1 i.e. the code is in a long position and will then issue these exit orders.

Regards,

ABCTG

Follow me on Twitter Reply With Quote
  #3 (permalink)
 my2108 
Kowloon, Hong Kong
 
Experience: Advanced
Platform: MC
Broker: IB
Trading: HSI
Posts: 17 since Aug 2018
Thanks Given: 3
Thanks Received: 3


HI ABCTG,

I am aware of what Sell and BuytoCover do. Just that if I look at the first "If" statement, if Position != 1, then it still triggers a sell...that's the bit I don't understand.

And if you look at ATR Trailing SX signal, if Position != -1 (hence either in flat or positive position) then it will still trigger a buytocover :

 
Code
var0 = AvgTrueRange( ATRLength ) * NumATRs ;
var1 = MarketPosition ;

if var1 = -1 then 
	begin
	condition1 = var1[1] <> -1 or Low < var2 ;
	if condition1 then 
		var2 = Low ;
	Buy To Cover ( "AtrSX" ) next bar at var2 + var0 stop ;
	end
else
	Buy To Cover ( "AtrSX-eb" ) next bar at Low + var0 stop ;
Anyone who can give me some guidance will be highly apprecaited.


ABCTG View Post
my2108,

in Multicharts PowerLanguage "Sell" refers to exiting a long position and "BuyToCover" is the cover of a short position.

The code you posted checks for the MarketPosition being 1 i.e. the code is in a long position and will then issue these exit orders.

Regards,

ABCTG


Follow me on Twitter Started this thread Reply With Quote
  #4 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,441 since Apr 2013
Thanks Given: 491
Thanks Received: 1,634

my2108,

I am not sure I follow you correctly. The code example you posted below has the first if statement starting with: "if var1 = -1 then" i.e. it is only executed when you are in a short position and it triggers "Buy To Cover" orders i.e. the closing orders for the short position.
The second Buy To Cover simply serves as an entry bar protection as without intrabar order generation the change in the market position would only be detected until the end of the bar. This way you are not left without a stop during your entry bar and the platform won't issue the order when you are flat or long.

Regards,

ABCTG


my2108 View Post
HI ABCTG,

I am aware of what Sell and BuytoCover do. Just that if I look at the first "If" statement, if Position != 1, then it still triggers a sell...that's the bit I don't understand.

And if you look at ATR Trailing SX signal, if Position != -1 (hence either in flat or positive position) then it will still trigger a buytocover :

 
Code
var0 = AvgTrueRange( ATRLength ) * NumATRs ;
var1 = MarketPosition ;

if var1 = -1 then 
	begin
	condition1 = var1[1] <> -1 or Low < var2 ;
	if condition1 then 
		var2 = Low ;
	Buy To Cover ( "AtrSX" ) next bar at var2 + var0 stop ;
	end
else
	Buy To Cover ( "AtrSX-eb" ) next bar at Low + var0 stop ;
Anyone who can give me some guidance will be highly apprecaited.


Follow me on Twitter Reply With Quote
Thanked by:
  #5 (permalink)
 my2108 
Kowloon, Hong Kong
 
Experience: Advanced
Platform: MC
Broker: IB
Trading: HSI
Posts: 17 since Aug 2018
Thanks Given: 3
Thanks Received: 3

HI ABCTG - thanks for your comment...the intrabar order generation insight is something new to me...
But thats very useful indeed.

Thank you again.

ABCTG View Post
my2108,

I am not sure I follow you correctly. The code example you posted below has the first if statement starting with: "if var1 = -1 then" i.e. it is only executed when you are in a short position and it triggers "Buy To Cover" orders i.e. the closing orders for the short position.
The second Buy To Cover simply serves as an entry bar protection as without intrabar order generation the change in the market position would only be detected until the end of the bar. This way you are not left without a stop during your entry bar and the platform won't issue the order when you are flat or long.

Regards,

ABCTG


Follow me on Twitter Started this thread Reply With Quote




Last Updated on November 17, 2018


© 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 - Sitemap - Downloads - Top
no new posts