NexusFi: Find Your Edge


Home Menu

 





entryprice = 0 when using set percent trailing


Discussion in EasyLanguage Programming

Updated
      Top Posters
    1. looks_one Basura with 1 posts (0 thanks)
    2. looks_two mixpol with 1 posts (0 thanks)
    3. looks_3 Quick Summary with 1 posts (0 thanks)
    4. looks_4 ABCTG with 1 posts (0 thanks)
    1. trending_up 2,790 views
    2. thumb_up 0 thanks given
    3. group 4 followers
    1. forum 4 posts
    2. attach_file 0 attachments




 
Search this Thread

entryprice = 0 when using set percent trailing

  #1 (permalink)
hangtime15
Hong Kong
 
Posts: 1 since May 2015
Thanks Given: 0
Thanks Received: 0

Hello I am a beginner to MC and I have experienced the following problem when using the setpercenttrailing function

when I writing the code below


SetPercentTrailing( entryprice(0)* 1.1, 50 ) ;



the entry price is always 0 and will trigger the sell order right after buy in

can anyone can help me with this?
Thanks a lot.

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
static margin on the right side of a chart
NinjaTrader
Quantum physics & Trading dynamics
The Elite Circle
Negative Balance Protection
Brokers
Better Renko Gaps
The Elite Circle
Strategy stop orders partially filled
EasyLanguage Programming
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Funded Trader platforms
33 thanks
Spoo-nalysis ES e-mini futures S&P 500
16 thanks
GFIs1 1 DAX trade per day journal
15 thanks
The Trading Pit "Futures VIP" Account Journal
15 thanks
Trading with Intuition
14 thanks
  #3 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,436 since Apr 2013
Thanks Given: 484
Thanks Received: 1,629


hangtime15,

I would suggest that you take a look at the MC help file and the explanation of SetPercentTrailing. From the code snippet I am under the impression you did not code what you have in mind. So curing the situations where entryprice(0) = 0 might not help you out.

Regards,
ABCTG


hangtime15 View Post
Hello I am a beginner to MC and I have experienced the following problem when using the setpercenttrailing function

when I writing the code below


SetPercentTrailing( entryprice(0)* 1.1, 50 ) ;



the entry price is always 0 and will trigger the sell order right after buy in

can anyone can help me with this?
Thanks a lot.


Follow me on Twitter Reply With Quote
  #4 (permalink)
mixpol
Kazan russia
 
Posts: 31 since Dec 2013
Thanks Given: 2
Thanks Received: 5


hangtime15 View Post
Hello I am a beginner to MC and I have experienced the following problem when using the setpercenttrailing function

when I writing the code below


SetPercentTrailing( entryprice(0)* 1.1, 50 ) ;



the entry price is always 0 and will trigger the sell order right after buy in

can anyone can help me with this?
Thanks a lot.

setpercenttrailing is a macro command with 1 input parametr in dollar risk value! set up only once in any place of code!
try to use this
setstopposition;
mp=marketposition;
ep=entryprice;
if mp=1 then SetPercentTrailing( (ep* 1.1 ) );

Reply With Quote
  #5 (permalink)
Basura
Brisbane, Australia
 
Posts: 7 since Jan 2013
Thanks Given: 14
Thanks Received: 0


hangtime15 View Post
Hello I am a beginner to MC and I have experienced the following problem when using the setpercenttrailing function

when I writing the code below


SetPercentTrailing( entryprice(0)* 1.1, 50 ) ;



the entry price is always 0 and will trigger the sell order right after buy in

can anyone can help me with this?
Thanks a lot.

If you're not having any luck with EntryPrice( 0 ) you could try OpenEntryPrice( 0 ) - the difference is the first references the position (i.e. a zero references the open position, whereas a 1 is the previous position), and the second references trades (i.e. a zero references the first trade in an open position, a 1 references the 2nd trade etc).

You should also look up the difference between SetStopPosition, SetStopContract and SetStopShare which should be added before your SetPercentTrailing code. Based on your code i think SetStopContract is what you're after (by default SetStopPosition is applied). Your code "entryprice(0)* 1.1" suggests a position size of 1 contract and a profit threshold of 110%.

Finally another thing I learned using SetBreakEven and SetPercentTrailing is you should not have them nested within any other code (e.g. IF ... THEN SetPercentTrailing() )

Good luck!

Reply With Quote




Last Updated on July 20, 2015


© 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