Trying to set trailing stop to be two ticks below the low>> HELP! - NinjaTrader Programming | futures io social trading
futures io futures trading


Trying to set trailing stop to be two ticks below the low>> HELP!
Updated: Views / Replies:1,260 / 22
Created: by budfox Attachments:0

Welcome to futures io.

Welcome, Guest!

This forum was established to help traders (especially futures traders) by openly sharing indicators, strategies, methods, trading journals and discussing the psychology of trading.

We are fundamentally different than most other trading forums:
  • We work extremely hard to keep things positive on our forums.
  • We do not tolerate rude behavior, trolling, or vendor advertising in posts.
  • We firmly believe in openness and encourage sharing. The holy grail is within you, it is not something tangible you can download.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.


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, and we will never resell your private information.

-- Big Mike

Reply
 
Thread Tools Search this Thread
 

Trying to set trailing stop to be two ticks below the low>> HELP!

  #11 (permalink)
Trading Apprentice
Chicago, IL
 
Futures Experience: Advanced
Platform: Tradestation + Multicharts
Favorite Futures: Forex, Futures
 
Posts: 34 since Jul 2013
Thanks: 21 given, 1 received

hi Kevin

So to reignite this thread -- With % trailing, we know the trailing stops are executed intrabar. My question is - Is there a way to only execute % trailing at the end of the bar, and NOT intrabar?

(even with [Intrabarordergeneration = False] it'll still trigger the order)

thanks in advance for any info!
-Brandon

Reply With Quote
 
  #12 (permalink)
Market Wizard
Cleveland Ohio/United States
 
Futures Experience: Advanced
Platform: Tradestation
Broker/Data: various
Favorite Futures: futures
 
Posts: 2,256 since Jul 2012
Thanks: 1,059 given, 4,101 received


djvie11 View Post
hi Kevin

So to reignite this thread -- With % trailing, we know the trailing stops are executed intrabar. My question is - Is there a way to only execute % trailing at the end of the bar, and NOT intrabar?

(even with [Intrabarordergeneration = False] it'll still trigger the order)

thanks in advance for any info!
-Brandon

If you wrote code that calculated the price you wanted, you could.

Say you were long, and you calculate a price of XXXX to exit. Then it is simply:

if close<XXXX sell this bar at close;

This won't work on last bar of day though.

You could also do something like:

sell next bar at XXXX stop;

where XXXX is calculated based on a percent trailing or whatever you want.

If you have any questions please send me a Private Message or use the futures.io "Ask Me Anything" thread
Reply With Quote
The following user says Thank You to kevinkdog for this post:
 
  #13 (permalink)
Trading Apprentice
Chicago, IL
 
Futures Experience: Advanced
Platform: Tradestation + Multicharts
Favorite Futures: Forex, Futures
 
Posts: 34 since Jul 2013
Thanks: 21 given, 1 received



kevinkdog View Post
If you wrote code that calculated the price you wanted, you could.

Say you were long, and you calculate a price of XXXX to exit. Then it is simply:

if close<XXXX sell this bar at close;

This won't work on last bar of day though.

You could also do something like:

sell next bar at XXXX stop;

where XXXX is calculated based on a percent trailing or whatever you want.

Thank you for the response, Kevin!

I'm now trying to make it a condition, but when I try to compile it it's saying "expression expected here." Obviously I'm coding this wrong.

 
Code
Condition1 = C[1] of data2 < SetPercentTrailing( FloorAmt, TrailingPct ) ;

Reply With Quote
 
  #14 (permalink)
Market Wizard
Cleveland Ohio/United States
 
Futures Experience: Advanced
Platform: Tradestation
Broker/Data: various
Favorite Futures: futures
 
Posts: 2,256 since Jul 2012
Thanks: 1,059 given, 4,101 received


djvie11 View Post
Thank you for the response, Kevin!

I'm now trying to make it a condition, but when I try to compile it it's saying "expression expected here." Obviously I'm coding this wrong.

 
Code
Condition1 = C[1] of data2 < SetPercentTrailing( FloorAmt, TrailingPct ) ;

You've got to create your own trailing stop expression. MaxpositionProfit and OpenPositionProfit could be useful.

Maybe if MaxpositionProfit-OpenPositionProfit>1000 //means when your current profit is $1000 less than the maximum profit the position hit at one time...

If you have any questions please send me a Private Message or use the futures.io "Ask Me Anything" thread
Reply With Quote
The following user says Thank You to kevinkdog for this post:
 
  #15 (permalink)
Trading Apprentice
Chicago, IL
 
Futures Experience: Advanced
Platform: Tradestation + Multicharts
Favorite Futures: Forex, Futures
 
Posts: 34 since Jul 2013
Thanks: 21 given, 1 received


kevinkdog View Post
You've got to create your own trailing stop expression. MaxpositionProfit and OpenPositionProfit could be useful.

Maybe if MaxpositionProfit-OpenPositionProfit>1000 //means when your current profit is $1000 less than the maximum profit the position hit at one time...

Great idea, Kevin.

I came up with this, but I'm having trouble figuring out the command to cover the position at the end. I used SetStopPosition but that's not correct.

 
Code
Inputs:
PctTrail (.25),
DollarAmt (20);

Condition1 = MaxpositionProfit > DollarAmt ;
Condition2 = MaxpositionProfit < MaxpositionProfit - (MaxPositionProfit * PctTrail);

IF Condition1 AND Condition2
THEN 
SetStopPosition  ;

Reply With Quote
 
  #16 (permalink)
Market Wizard
Cleveland Ohio/United States
 
Futures Experience: Advanced
Platform: Tradestation
Broker/Data: various
Favorite Futures: futures
 
Posts: 2,256 since Jul 2012
Thanks: 1,059 given, 4,101 received


djvie11 View Post
Great idea, Kevin.

I came up with this, but I'm having trouble figuring out the command to cover the position at the end. I used SetStopPosition but that's not correct.

 
Code
Inputs:
PctTrail (.25),
DollarAmt (20);

Condition1 = MaxpositionProfit > DollarAmt ;
Condition2 = MaxpositionProfit < MaxpositionProfit - (MaxPositionProfit * PctTrail);

IF Condition1 AND Condition2
THEN 
SetStopPosition  ;



If you want to exit right when this is evaluated as true, then

sell this bat at close;

would work (except for last bar of day)

or

sell next bar at market;

If you have any questions please send me a Private Message or use the futures.io "Ask Me Anything" thread
Reply With Quote
 
  #17 (permalink)
Trading Apprentice
Chicago, IL
 
Futures Experience: Advanced
Platform: Tradestation + Multicharts
Favorite Futures: Forex, Futures
 
Posts: 34 since Jul 2013
Thanks: 21 given, 1 received


kevinkdog View Post
If you want to exit right when this is evaluated as true, then

sell this bat at close;

would work (except for last bar of day)

or

sell next bar at market;

Understood.

Is there a command though that would exit both LONG (sell this bar at close) and SHORT (buy to cover at close) positions?

Reply With Quote
 
  #18 (permalink)
Market Wizard
Cleveland Ohio/United States
 
Futures Experience: Advanced
Platform: Tradestation
Broker/Data: various
Favorite Futures: futures
 
Posts: 2,256 since Jul 2012
Thanks: 1,059 given, 4,101 received


djvie11 View Post
Understood.

Is there a command though that would exit both LONG (sell this bar at close) and SHORT (buy to cover at close) positions?


setexitonclose;

but remember it will not work with real money on last bar of day. It works in backtest though.

If you have any questions please send me a Private Message or use the futures.io "Ask Me Anything" thread
Reply With Quote
The following user says Thank You to kevinkdog for this post:
 
  #19 (permalink)
Trading Apprentice
Chicago, IL
 
Futures Experience: Advanced
Platform: Tradestation + Multicharts
Favorite Futures: Forex, Futures
 
Posts: 34 since Jul 2013
Thanks: 21 given, 1 received


kevinkdog View Post
setexitonclose;

but remember it will not work with real money on last bar of day. It works in backtest though.

your knowledge is much appreciated, Kevin!

happy trading.

Reply With Quote
 
  #20 (permalink)
Trading Apprentice
Chicago, IL
 
Futures Experience: Advanced
Platform: Tradestation + Multicharts
Favorite Futures: Forex, Futures
 
Posts: 34 since Jul 2013
Thanks: 21 given, 1 received



kevinkdog View Post
setexitonclose;

but remember it will not work with real money on last bar of day. It works in backtest though.

And for what it's worth - that last bit of code I posted didn't work (It didn't understand the variables). This new code below works.

 
Code
Inputs:
PctTrail (.25),
DollarAmt (20);

IF
(OpenPositionProfit + DollarAmt) < MaxPositionProfit - (MaxPositionProfit * PctTrail) 
THEN 
SetExitOnClose  ;

Reply With Quote

Reply



futures io > > > > > Trying to set trailing stop to be two ticks below the low>> HELP!

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

FIO Journal Challenge featuring NinjaTrader ($2,000+ of prizes)

May

An overview of volumetric analytical tools w/Sergey Sokolov @ PTMC

Elite only

John Hoagland (TBA)

Elite only

FuturesTrader71 Extended Ask Me Anything (AMA)

Elite only

Pete @ Jigsaw Trading (TBA)

Elite only

John @ No BS Day Trading (TBA)

Elite only

An Afternoon with FIO member Softsoap (being rescheduled)

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
CLICK HERE if you are landlord>>> Creditor trying to garnish my precious rent budfox Off-Topic 16 May 12th, 2014 11:25 AM
ACD System>>>A & C Values for the ES budfox Emini Index Futures Trading 3 October 28th, 2013 04:20 PM
Difference in simulator trading the ES and live trading with a small account>>> budfox Traders Hideout 8 July 6th, 2013 10:59 PM
BLUELINE DELIGHT >>>Intraday Trading Strategy Guide<<< Gabriyele The Elite Circle 407 May 30th, 2013 07:29 AM
TIP : Search for free NinjaTrader Indicator on BMT ? >> How to use our searchtools ! max-td Beginners and Introductions 2 July 19th, 2010 06:16 AM


All times are GMT -4. The time now is 04:46 PM.

Copyright © 2017 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, 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
Page generated 2017-05-28 in 0.13 seconds with 19 queries on phoenix via your IP 54.162.44.105