Login Page - Create Account

Support Board


Date/Time: Sat, 04 May 2024 04:51:04 +0000



Flat to Flat Average price with Scale out Profits factored in it

View Count: 1443

[2017-03-08 00:24:23]
User299392 - Posts: 216
Now, I know you guys do not answer questions that involve developmental issues.
But I just want to probe to find out if I am not missinG anything that is available in Sierra and I am not using it. Or maybe just a workaround - please - this is important - just a few lines of response is what I looking for here.

Is it possible to have an Average price of the existing position factor into account the profits of the scaled out position before the flat-to-flat position was assumed?
Meaning if -
1. I bought 4 lots $500 each for total of $2000.00 and then
2. Sold 1 for say $700 with $200 in profits;
3. My existing position to be displayed should be 3 lots for a net cost of $1300 bringing the average to $433.33 (instead of a going flat-to-flat average of $500.00)?

Simple 3 qs, please -

1. Is this possible in Sierra in its existing form?
2. Is there a workaround with the use of spreadsheets?
3. Is it is lined up in future developments? please - will really appreciate feedback here, please.
[2017-03-08 05:24:44]
Sierra Chart Engineering - Posts: 104368
1. No.

2. No. Maybe you can do this with ACSIL instead.

3. No.
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
[2017-03-08 14:36:25]
Sawtooth - Posts: 3993
I think a workaround could be achieved using the Spreadsheet System for Trading study.

J7 is the Prior Position Quantity
J8 is the current Position Quantity
J9 is the current Position Average Price
J44 is the Last Trade Profit/Loss
J48 if the Last Entry Fill Price

With these data, you should be able to calculate a net cost before and after a scale-out.
You could then display that value with the Text Display for Study study.
[2017-03-08 19:26:59]
User299392 - Posts: 216
tomgilb -

Do you have any such worksheet handy that I can use and customize?
[2017-03-08 20:00:00]
Sawtooth - Posts: 3993
Add the Spreadsheet System for Trading study, give it a name in the Spreadsheet Name field.

Start with this formula in cell O3:
=($J$48*$J$8-$J$44)/$J$8

Since this study will place trades, be safe and do this:
- do NOT put any formulas in columns K-N.
- enter 1 in cell J28 to disable autotrading.

You can minimize the spreadsheet.

To display the value on the chart, use the Text Display for Study study and reference SG5 of the spreadsheet study.
[2017-03-13 17:18:11]
User299392 - Posts: 216
Ahhh....got logged out. Thought my response went thru.

On this one; many thanks but for 2 issues -

1. It does not help track multiple scale out profits;
2. J44 i.e. Last Trade P/L only reflects last fill based P/L; not the Last entire Scale Out quantity based P/L.

Will appreciate comments!
Thanks again!
[2017-03-13 23:14:13]
Sawtooth - Posts: 3993
To track cumulative trade P/L at scale-outs, you'll need to:
1) add the Trading:Daily Profit/Loss study.
2) in another formula column, create a persistent variable of the entry price beginning in the row where the entry occurred.
3) in another formula column, create a persistent variable of the P/L from the Trading:Daily P/L study's output when #2 starts.
4) in another formula column, subtract the value of #3 from the Trading:Daily P/L study's output.
5) reference row 3 of #4 in O3 instead of J44.

There may be other things to consider, but what you want to do is possible with this spreadsheet study.
[2017-03-13 23:31:35]
User299392 - Posts: 216
Nice; very nice. I understand it all.

Except one question only and I will go cracking on this - persistent variable? How do I create one in the spreadsheet? Some example or a link or guidance will do it all for me.


Please?

Many Thanks Yet Again!
[2017-03-14 00:09:40]
Sawtooth - Posts: 3993
A persistent variable can be created in a spreadsheet study by a formula like this, e.g. in cell P3:
=IF(condition1,variable1,P4)
Based on what you are doing, you shouldn't need another IF to release it. The idea is to bring the value to row 3 which is the current price bar.

Starting a persistent variable (#2 in post #7) in the row where the entry occurred will require an absolute reference to J42, comparing it to the time in column A. You may want to extract the time of day from the serial datetime like this:
=$J$42-INT($J$42)
=A3-INT(A3)
[2017-03-14 00:27:42]
User299392 - Posts: 216
I clearly understand the logic and I am fine with it.

My handicap is the actual syntax here.

So, I go like this for what you mentioned,

=IF(condition1,variable1,P4)

=If(
time of entry=current time in column A {assuming this is condition 1 - I can handle the int() to trim it},
Daily Profit/Loss{assuming this is the variable},
"p4" {did not understand this part}
)


Any closer?
[2017-03-14 00:55:28]
Sawtooth - Posts: 3993
The reference to P4 in P3 is what brings the value to the current row.
In Formula Columns, spreadsheet studies will autofill rows below row 3, incrementing the row reference to P4, and P3.

Try this example making the bar high price persistent from row 7:
in Z3:
=IF(ROW()=7,C3,Z4)

Now look at the formulas in Z4, Z5, Z6, Z7.
[2017-03-15 00:36:02]
User299392 - Posts: 216
So, thanks a ton for the encouragement.
As you said, there were many other things to take care of before I could get to the final solution.
Took a good part of my day and life. Realized my worth in coding. But I think it will be well worth it.

That said, I figured an alternate way to do it where I used a study called Trading:Positions and tracked cost basis with it all along until the position flattens out. And that did the trick.

Just wanted to ask you if there is anything you use for trading futures, if at all - that you have built with Sierra and is helping you a lot. If so, please consider sharing - I may be also willing to justify your time and costs if you did.

Let me know, please!
AMIRACED@GMAIL.COM
[2018-02-23 13:14:53]
User942837 - Posts: 108
Do you care to share your solution please I still don't understand how you did this.

thanks

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

Login

Login Page - Create Account