NexusFi: Find Your Edge


Home Menu

 





Another Trail Stop question


Discussion in EasyLanguage Programming

Updated
    1. trending_up 3,461 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?
ZombieSqueeze
Platforms and Indicators
Positive review - Whole Brain Trading
Trading Reviews and Vendors
static margin on the right side of a chart
NinjaTrader
MC Advanced Simulated Trading.
MultiCharts
Legends Trading: Ask Me Anything (AMA) w/Greg Khojikian CEO
Trading Reviews and Vendors
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Vinny E-Mini & Algobox Review TRADE ROOM
87 thanks
GFIs1 1 DAX trade per day journal
30 thanks
Risk/reward above 1.0
20 thanks
What Do You Replace Positive Thing With
17 thanks
Big Mike in Ecuador
10 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


© 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