Another Trail Stop question - futures io
futures io



Another Trail Stop question


Discussion in EasyLanguage Programming

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




Welcome to futures io: the largest futures trading community on the planet, with well over 150,000 members
  • Genuine reviews from real traders, not fake reviews from stealth vendors
  • Quality education from leading professional traders
  • We are a friendly, helpful, and positive community
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts
  • We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

(If you already have an account, login at the top of the page)

 
Search this Thread
 

Another Trail Stop question

(login for full post details)
  #11 (permalink)
gurji
Miami, Florida
 
 
Posts: 29 since Apr 2022
Thanks: 1 given, 8 received


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 futures io?
Book for fundamental analysis
Stocks and ETFs
Market on Close data within IB
Platforms and Indicators
Demo accounts order fill
Emini and Emicro Index
Big Mo Indicator for NT8
NinjaTrader
Multi Time Frame High/Low/Median levels
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on futures io
Is anyone actually making money?
52 thanks
An embarrassing, honest confession
37 thanks
Sierra vs. Ninja : why I chose .....
8 thanks
Machine Learning Journal
5 thanks
Institutional Grade Massive Data Dump for Quant Research …
5 thanks
 
(login for full post details)
  #12 (permalink)
gurji
Miami, Florida
 
 
Posts: 29 since Apr 2022
Thanks: 1 given, 8 received


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


futures io Trading Community Platforms and Indicators EasyLanguage Programming > Another Trail Stop question


Last Updated on September 21, 2022


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing
     



Copyright © 2023 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada), info@futures.io
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.
no new posts