NexusFi: Find Your Edge


Home Menu

 





Another Trail Stop question


Discussion in EasyLanguage Programming

Updated
    1. trending_up 5,655 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?
Powell in 48 Hours: Word Markets Give 78% on Inflation, …
Prediction Markets & Event Contracts
I Have a Thing Called Iran -- Trump Stays in DC as Airsp …
Prediction Markets & Event Contracts
Coinbase Launches Regulated Crypto Futures Across 26 Eur …
Cryptocurrency
April FOMC Minutes: Most Divided Fed Since 1992 -- Many …
Traders Hideout
El Clasico Draws $9.2M in Prediction Market Action -- Bi …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Sober Journey With S&P
20 thanks
2026 Jlab journal
10 thanks
Trying to learn Volume and price action correlation
8 thanks
Algo automated / semi-automated trading anyone?
6 thanks
Lady Vols Primer: Trading Volatility Journal
5 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