How do I get current price ? I need to calculate position's entry price minus current price.
Example: I would like to have more than one order, New order will be generated when current price is 1% down from last position's entry price.
I need last orders's entry price MINUS current real-time price.
Thanks
Size:
Color:
QUOTE:
How do I get current price ?
Please see the WealthScript Programming Guide,
The Bars Object > OHLC/V Series > How to: Access a OHLC/V value.QUOTE:
I need to calculate position's entry price minus current price.
Hit F11, in the QuickRef window find the Position object,
EntryPrice Property.
QUOTE:
I need last orders's entry price MINUS current real-time price.
Current real-time price (the ghost bar) is inaccessible.
QUOTE:
I would like to have more than one order, New order will be generated when current price is 1% down from last position's entry price.
CODE:
Please log in to see this code.
Size:
Color:
Thanks Eugene,
Can I specify number of shares on the BuyAtMarket function ?
I would like to buy 100 shares on 1st order, 2nd order would be 500 shares.
Thanks
Size:
Color:
Unfortunately no, until a newer version comes out that will support scripting the position size (so called PosSizers aka $imuscripts in Version 4).
Size:
Color:
Eugene,
Do you have a routine that calculates total profit of all positions ?
If not, Do I calculate each position's entry price - current price) * shares and add it ?
Thanks
Bruce
Size:
Color:
Hi Bruce,
If you wanted to do a manual calculation inside your Strategy code, then the Shares property will always be 1 while the Strategy is executing.
Size:
Color:
Hi Eugene,
Here's my code, Can you please fix it ?
CODE:
Please log in to see this code.
High[bar] - p.EntryPrice does not work because High could be the same bar as entry bar and myProfit calculations is invalid. If it is possible, I need to calculate real time total profit.
Thanks
Bruce
Size:
Color:
Bruce,
Please re-read my reply from 5/20/2009 11:34 AM.
Note that the Position object already has the necesary properties like .NetProfitAsOfBar/.NetProfitAsOfBarPercent etc. - you'll find them along with some code examples illustrating their usage in the QuickRef.
Size:
Color:
Thanks Eugene. NetProfitAsOfBar works.
I can't wait for the newer version that will support scripting the position size,
Will it be this year ?
Size:
Color:
Size:
Color: