NexusFi: Find Your Edge


Home Menu

 





five digits after the decimal point using "entryprice" function


Discussion in MultiCharts

Updated
    1. trending_up 1,225 views
    2. thumb_up 2 thanks given
    3. group 3 followers
    1. forum 3 posts
    2. attach_file 0 attachments




 
Search this Thread

five digits after the decimal point using "entryprice" function

  #1 (permalink)
 avasfx 
Poland
 
Experience: Intermediate
Platform: Multicharts, RealTest
Broker: AMP, TradeNation, IntractiveBrokers
Trading: ES, DAX, YM, FTSE
Posts: 23 since Jul 2009
Thanks Given: 15
Thanks Received: 1

Hello,
i'm fairly new to PowerLanguage and programming at all. So please excuse me

i'm trying to code some conditions, after first target was reached, stop loss will be moved to BE + x%. For this i'm using build-in function: entryprice(0) like this:

if high >= Fib1_55 then sell ("BE") 2000 contracts next bar at (entryprice(0)+(entryprice(0)*0.05)/100) stop;

The problem is, when i print(entryprice(0)) it gives me 1.31 insted of 1.31992 (GBP/USD pair, using oanda datafeed).
I've tried to use "round" function - round(entryprice(0)+(entryprice(0)*0.05)/100),5) but it still returns 1.31. Where could be a problem here?
Thanks in advance,
Alex

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
MC PL editor upgrade
MultiCharts
What broker to use for trading palladium futures
Commodities
Better Renko Gaps
The Elite Circle
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
REcommedations for programming help
Sierra Chart
 
  #2 (permalink)
 ocpb 
Hartford CT, USA
 
Experience: Beginner
Platform: None
Trading: ES
Posts: 126 since Jan 2015
Thanks Given: 152
Thanks Received: 125


avasfx View Post
Hello,
i'm fairly new to PowerLanguage and programming at all. So please excuse me

i'm trying to code some conditions, after first target was reached, stop loss will be moved to BE + x%. For this i'm using build-in function: entryprice(0) like this:

if high >= Fib1_55 then sell ("BE") 2000 contracts next bar at (entryprice(0)+(entryprice(0)*0.05)/100) stop;

The problem is, when i print(entryprice(0)) it gives me 1.31 insted of 1.31992 (GBP/USD pair, using oanda datafeed).
I've tried to use "round" function - round(entryprice(0)+(entryprice(0)*0.05)/100),5) but it still returns 1.31. Where could be a problem here?
Thanks in advance,
Alex

Looks like you may control the precision of the outputted value, if you follow the instructions here:
https://www.multicharts.com/trading-software/index.php/Print

Currently you're accepting the default which is 2 decimal places.

Reply With Quote
Thanked by:
  #3 (permalink)
 avasfx 
Poland
 
Experience: Intermediate
Platform: Multicharts, RealTest
Broker: AMP, TradeNation, IntractiveBrokers
Trading: ES, DAX, YM, FTSE
Posts: 23 since Jul 2009
Thanks Given: 15
Thanks Received: 1


Thanks ocpb, I didn't know about it. But I'm using print function just to understand what's going wrong. The main problem is that stop order was not generated based on my condition, that's why I was trying to print it and see what's wrong inside.
ocpb View Post
Looks like you may control the precision of the outputted value, if you follow the instructions here:
https://www.multicharts.com/trading-software/index.php/Print

Currently you're accepting the default which is 2 decimal places.

Sent using the NexusFi mobile app

Started this thread Reply With Quote
  #4 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,436 since Apr 2013
Thanks Given: 482
Thanks Received: 1,629

avasfx,

the prevision is only related to the Print reserved word. Internally your code would use the number of decimal spaces the reserved words return.
Keep in mind that MC will keep orders alive until the next code calculation only - if your order conditions are still valid the order would remain alive until the next code calculation otherwise it would get cancelled.

Regards,

ABCTG



avasfx View Post
Thanks ocpb, I didn't know about it. But I'm using print function just to understand what's going wrong. The main problem is that stop order was not generated based on my condition, that's why I was trying to print it and see what's wrong inside.

Sent using the NexusFi mobile app


Follow me on Twitter Reply With Quote
Thanked by:




Last Updated on February 3, 2020


© 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