NexusFi: Find Your Edge


Home Menu

 





entryprice = 0 when using set percent trailing


Discussion in EasyLanguage Programming

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




 
Search this Thread
  #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?
Strategy runs differently with in Automated Order Execut …
MultiCharts
Ticksandtrades.com
Trading Reviews and Vendors
Feb & Mar24 New Ag Micros & New Solana Crypto Fu …
Traders Hideout
Requesting replay data for...
NinjaTrader
NT TopStep discount?
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Tariffs and what comes next...
35 thanks
Looking for advice from seasoned TopSteppers
5 thanks
Lady Vols Primer: Trading Volatility Journal
5 thanks
Big Mike in Ecuador
3 thanks
Converting NT7 indicators to NT8 for free
3 thanks
  #3 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,447 since Apr 2013
Thanks Given: 493
Thanks Received: 1,639


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 X 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


© 2025 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 - Downloads - Top
no new posts