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,771 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?
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
REcommedations for programming help
Sierra Chart
Trade idea based off three indicators.
Traders Hideout
NexusFi Journal Challenge - May 2024
Feedback and Announcements
MC PL editor upgrade
MultiCharts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Spoo-nalysis ES e-mini futures S&P 500
48 thanks
Just another trading journal: PA, Wyckoff & Trends
32 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
24 thanks
GFIs1 1 DAX trade per day journal
22 thanks
  #3 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,435 since Apr 2013
Thanks Given: 482
Thanks Received: 1,628


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