Login Page - Create Account

Support Board


Date/Time: Mon, 25 Nov 2024 21:37:11 +0000



Position Data Structure Members

View Count: 1137

[2014-03-03 18:15:08]
User82615 - Posts: 106
Hello I want to program a trading system that calculates the open profit/loss of my actual open position to exit when it has at a close of a bar a profit or 8 points and the close of the bar is lower that the open of the bar.

For example I tried with : PositionData.OpenProfitLoss > 8 && sc.GetBarHasClosedStatus () == BHCS_BAR_HAS_CLOSED && sc.BaseDataIn [SC_LAST] [sc.Index] < sc.BaseDataIn[OPEN][sc.Index] to exit my position but the system doesn't calculates the OpenProfitLoss > 8 , it exits my position as soon as the close of the bar is lower that the open.

Am I doing anything wrong?

Thank you for your help
[2014-03-04 09:01:23]
Sierra Chart Engineering - Posts: 104368
Have you confirmed the value you are getting from PositionData.OpenProfitLoss? We have to check but this is probably given as a currency value.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
[2014-03-04 11:17:59]
User82615 - Posts: 106
Or maybe this function only returns if the position is in profit or loss but doesn't return the exact value of the position?Could be this?.

And yes I looked at the description of this function in the table of contents and yes it is given as a currency value.
But what that this mean?

Thanks for your help
[2014-03-04 11:22:35]
User82615 - Posts: 106
Another thing,I saw in the decription and this function is a double type (not an integer),so when programing this function do I have to put double instead of an i of integer?

Thank you very much
[2014-03-04 11:46:16]
User82615 - Posts: 106
Thank you I already have it working , and yes the problem was that I was not programming it as a currency value , I was programming it as ticksize.

Actualy I programmed the system and does the backtest perfect, but do I have to put (double) instead of (i) in the Position structure members:

s_SCPositionData PositionData;
sc.GetTradePosition(PositionData);
double Positiondata.OpenProfitLoss ??

because it is a double type structure instead of an integer ?

Thank you very much
[2014-03-04 17:08:09]
Sierra Chart Engineering - Posts: 104368
The OpenProfitLoss is a double precision floating-point data type.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account