NexusFi: Find Your Edge


Home Menu

 





Another Trail Stop question


Discussion in EasyLanguage Programming

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




 
Search this Thread

Another Trail Stop question

(login for full post details)
  #11 (permalink)
gurji
Miami, Florida
 
Posts: 35 since Apr 2022
Thanks Given: 1
Thanks Received: 10


syswizard View Post
That is not the correct behavior as the Set statements should be active in the current bar. They are designed to operate INTRABAR and don't require [IntraBarOrderGeneration] to be on. It is independent of that condition.
The only thing I can think of is that the Set statement is not being called after the close of the last bar. It must be called in order to be active.

Please contact MC tech support with this problem and be ready to demonstrate this problem.

I'm using this on tradestation, not MC. But let me look at what you showed said first.

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Request for MACD with option to use different MAs for fa …
NinjaTrader
Futures Close-Out Policy
Commodities
ZombieSqueeze
Platforms and Indicators
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
The space time continuum and the dynamics of a financial …
Emini and Emicro Index
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
33 thanks
Daytrading ES & NQ
32 thanks
Spoo-nalysis ES e-mini futures S&P 500
28 thanks
Battlestations: Show us your trading desks!
23 thanks
Deaddogs Stock Trading
20 thanks

(login for full post details)
  #12 (permalink)
gurji
Miami, Florida
 
Posts: 35 since Apr 2022
Thanks Given: 1
Thanks Received: 10


syswizard View Post
That is not the correct behavior as the Set statements should be active in the current bar. They are designed to operate INTRABAR and don't require [IntraBarOrderGeneration] to be on. It is independent of that condition.
The only thing I can think of is that the Set statement is not being called after the close of the last bar. It must be called in order to be active.

Please contact MC tech support with this problem and be ready to demonstrate this problem.

Here is all the code that run the orders if conditions are met.

 
Code
if (atrOk = 1) and (curDirection = -1) and (ocatrOk = 1) and (ocsizeOk = 1) and (olpOk = 1) and (gWickOk = 1) and (bWickOk = 1) and (Marketposition = 0) then

	Begin
		tgamt = targetProfit;
		slamt = sl;
		if (ocatr >= highRatio) Then
			hiRatio = 1;
		Buy this bar at close;
		tmpPrice = close;	
	End;	
		
	
if (atrOk = 1) and (curDirection = 1) and (ocatrOk = 1) and (ocsizeOk = 1) and (olpOk = 1) and (gWickOk = 1) and (bWickOk = 1) and (Marketposition = 0) then
	Begin
		tgamt = targetProfit;
		slamt = sl;
		if (ocatr >= highRatio) Then
			hiRatio = 1;
		Sellshort this bar at close;
		tmpPrice = close;
	End;


if (hiRatio = 1) Then
	maxBars = timeExitHi Else
	maxBars = timeExit;
if MarketPosition <> 0 and BarsSinceEntry >= maxBars then begin

	
	if MarketPosition = 1 then Sell All Contracts Next Bar At Market;
	if MarketPosition = -1 then Buytocover All Contracts Next Bar At Market;

end;

trailPoints = 0.05;

if MarketPosition = 1 Then
	Begin
		trailValue = Highest(High, BarsSinceEntry);
		trailExit = trailValue - trailPoints;
		trailTrigger = tmpPrice + (tgamt*0.001);
		if	close >= (trailTrigger)   Then
			SetProfitTarget(trailExit) Else
			SetProfitTarget(tgamt);	
	End;
	
if MarketPosition = -1 Then
	Begin
		trailValue = Lowest(Low, BarsSinceEntry);
		trailExit = trailValue + trailPoints;
		trailTrigger = tmpPrice - (tgamt*0.001);		
		if	close <= (trailTrigger)   Then
			SetProfitTarget(trailExit) Else
			SetProfitTarget(tgamt);		
	End;

Reply With Quote





Last Updated on September 21, 2022


© 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