NexusFi: Find Your Edge


Home Menu

 





Another Trail Stop question


Discussion in EasyLanguage Programming

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




 
Search this Thread
  #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?
Peace Deal Forward Curve: May 22%, June 51%, December 81 …
Prediction Markets & Event Contracts
UMA Votes Tonight: Polymarkets $80M Strategy Bitcoin Bat …
Prediction Markets & Event Contracts
Post-Summit Scorecard: $36M in May 15 Bets Settle Near-Z …
Prediction Markets & Event Contracts
GDP Day: The First Economic Reckoning -- Pahlavi at 6.55 …
Prediction Markets & Event Contracts
CPI Eve: Fed Hike Odds Hold at 52% for the First Time, I …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
NexusFi site changelog and issues/problem reporting
13 thanks
Darmok and Jalad at Tanagra
3 thanks
Big Mike in Ecuador
1 thanks
30 Sessions
1 thanks
  #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


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