Signal Trailing stop loss not working as per code. - EasyLanguage Programming | futures io social day trading
futures io futures trading


Signal Trailing stop loss not working as per code.
Updated: Views / Replies:2,107 / 7
Created: by KumarHarsh Attachments:0

Welcome to futures io.

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

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • 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.

-- Big Mike, Site Administrator

Reply
 
Thread Tools Search this Thread
 

Signal Trailing stop loss not working as per code.

  #1 (permalink)
Trading Apprentice
Mumbai Maharashta India
 
Futures Experience: Intermediate
Platform: Multicharts
Favorite Futures: Futures
 
Posts: 4 since Sep 2012
Thanks: 3 given, 1 received

Signal Trailing stop loss not working as per code.

I am using a trailing dollar stop loss by following exponential moving average. I have modified trailing stop loss so that I can set stop loss to the ema value at the end of each bar. So only if the price hits the ema value the position is exited.

However, I noticed that the stop loss is being hit even when the ema is still far away from the lowest point. Is there an error in the way I have coded this?

I have attached the image.

[IntrabarOrderGeneration = False]
inputs: PositionBasis( false ), EMA_Length ( 10 );

variables: Amount ( 0 );

Amount = Close - XAverage(Close, EMA_Length );

if PositionBasis then
SetStopPosition
else
SetStopShare ;

if MarketPosition = 1 then
setdollartrailing( Amount) ;


Last edited by KumarHarsh; September 14th, 2012 at 07:07 AM. Reason: Adding an image to explain
Reply With Quote
 
  #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.

 
  #3 (permalink)
Banned: Repeated promotion of vendor site in numerous posts
London
 
Futures Experience: Intermediate
Platform: Amibroker, Multicharts
Favorite Futures: ES
 
Timot's Avatar
 
Posts: 26 since May 2011
Thanks: 20 given, 8 received

Answer
This post has been selected as an answer to the original posters question Answer



KumarHarsh View Post
I am using a trailing dollar stop loss by following exponential moving average. I have modified trailing stop loss so that I can set stop loss to the ema value at the end of each bar. So only if the price hits the ema value the position is exited.

Then I don't understand why you use the trailing stop function. Just use a stop order at the value of the ema. Unless I am missing something.

Reply With Quote
 
  #4 (permalink)
Elite Member
near Paris, France
 
Futures Experience: Beginner
Platform: -
Favorite Futures: -
 
Nicolas11's Avatar
 
Posts: 1,070 since Aug 2011
Thanks: 2,232 given, 1,729 received

Answer
This post has been selected as an answer to the original posters question Answer

Hi,

It may also depend on the instrument you trade.

You use:
setdollartrailing( Amount) ;

But are you sure that Amount as defined in your code is expressed in $?
For sure, it is expressed in price (I mean: the price displayed on the screen).
But, except for equities (?), this is not $.
In order to obtain $, you have to multiply it with the value of a full point in $.

Nicolas

Reply With Quote
 
  #5 (permalink)
Trading Apprentice
Mumbai Maharashta India
 
Futures Experience: Intermediate
Platform: Multicharts
Favorite Futures: Futures
 
Posts: 4 since Sep 2012
Thanks: 3 given, 1 received

How should the code change?

Dear Nicolas,

How do I go about doing this? How do I modify the code to take this into account?

Regards

Harsh


Nicolas11 View Post
Hi,

It may also depend on the instrument you trade.

You use:
setdollartrailing( Amount) ;

But are you sure that Amount as defined in your code is expressed in $?
For sure, it is expressed in price (I mean: the price displayed on the screen).
But, except for equities (?), this is not $.
In order to obtain $, you have to multiply it with the value of a full point in $.

Nicolas


Reply With Quote
 
  #6 (permalink)
Trading Apprentice
Mumbai Maharashta India
 
Futures Experience: Intermediate
Platform: Multicharts
Favorite Futures: Futures
 
Posts: 4 since Sep 2012
Thanks: 3 given, 1 received

Tried the suggestion


Timot View Post
Then I don't understand why you use the trailing stop function. Just use a stop order at the value of the ema. Unless I am missing something.

Dear Timot,

Thanks but I tired it. It just started trailing the close price. I am sure I have made a mistake. How can I rectify it?

Regards

Harsh

Reply With Quote
 
  #7 (permalink)
Banned: Repeated promotion of vendor site in numerous posts
London
 
Futures Experience: Intermediate
Platform: Amibroker, Multicharts
Favorite Futures: ES
 
Timot's Avatar
 
Posts: 26 since May 2011
Thanks: 20 given, 8 received


KumarHarsh View Post
Dear Nicolas,

How do I go about doing this? How do I modify the code to take this into account?

Regards

Harsh

I think you must multiply it by BigPointValue. Good suggestion by Nicolas11. But still my question stands.

Reply With Quote
 
  #8 (permalink)
Elite Member
near Paris, France
 
Futures Experience: Beginner
Platform: -
Favorite Futures: -
 
Nicolas11's Avatar
 
Posts: 1,070 since Aug 2011
Thanks: 2,232 given, 1,729 received


KumarHarsh View Post
Dear Nicolas,

How do I go about doing this? How do I modify the code to take this into account?

Regards

Harsh

First, I do not pretend that my answer closes the issue. There may be other problems in your code. I am not in position to review it. Read carefully the comments made by other futures.io (formerly BMT) members.

To implement my suggestion, just multiply Amount by the value of a full point in $.
You should know it for the instruments you trade.
Otherwise, you can use BigPointValue.
But I think it requires this field to be correctly input in QuoteManager (to be checked).

Nicolas


Last edited by Nicolas11; September 17th, 2012 at 06:02 AM.
Reply With Quote
The following user says Thank You to Nicolas11 for this post:

Reply



futures io > > > > > Signal Trailing stop loss not working as per code.

Thread Tools Search this Thread
Search this Thread:

Advanced Search



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

Jigsaw Trading: TBA

Elite only

FuturesTrader71: TBA

Elite only

NinjaTrader: TBA

Jan 18

RandBots: TBA

Jan 23

GFF Brokers & CME Group: Futures & Bitcoin

Elite only

Adam Grimes: TBA

Elite only

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
trailing stop or fixed? mannya Psychology and Money Management 16 July 30th, 2015 03:59 AM
Trailing stop following an indicator nanobiotech NinjaTrader Programming 9 October 3rd, 2011 10:50 AM
Trailing Stop Loss and Reverse shergenr NinjaTrader Programming 3 March 1st, 2011 11:05 AM
Trailing stop loss kavin729 NinjaTrader Programming 1 August 20th, 2010 02:17 PM
Working on profit-loss ratio cclsys NinjaTrader Programming 39 December 1st, 2009 11:32 PM


All times are GMT -4. The time now is 08: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-12-14 in 0.11 seconds with 33 queries on phoenix via your IP 54.221.73.186