Login Page - Create Account

Support Board


Date/Time: Fri, 03 May 2024 23:26:28 +0000



[User Discussion] - V1382 Exits when $J$8=0 even though formula AND Condition is $J$8>0

View Count: 2499

[2016-03-16 18:53:17]
User791263 - Posts: 151
1382 Release notes say Fills are improved; I installed it this morning. There may be more fills than a $J$8 positions test calls for?

I've only tried automated trading via spreadsheet for about 2 weeks.. so
I can't say this was not a problem before (or with my expression, or whether there is one),
but my AND conditions to stop further Exit expressions evaluation in formulas---
(which I first added today on Exit formulas that were working otherwise) does not seem to work.

I followed your instructions at
http://www.sierrachart.com/index.php?page=doc/doc_SystemsAlerts.php#UsingManualOrAttachedOrdersExits
Steps To Create a Trading System for Automated Trading
ΒΆ 27, test for open position at $J$8.

In front of my L-col. Exit formula, to suppress exits when no position, I have
=AND( $J$8>0, K3=0,L4=0, ... etc.
then several OR conditions to exit upon.

On the correct chart sheet#, I get true's in L-col. each few rows. Since almost no Buys/Positions exist in K, that can't be correct.
I used the Detail debug: $J$8 which shows 1-True when no Buy Entries are anywhere. Strange!

AutoTrade Study settings are set YES for:
Reset on new bar, Allow Multiple entries same dir, Allow entry w/ working order, Support Reversals, Allow Opposite Entry w/ Opposing Position.

This was run on "Replay", All Charts, Accurate Trading System Back Test Mode, set to 1-second Processing, with 1 second storage setting.
Positions limit- 2

I will try again in a bit via the Auto Trade System Back Test from the Trade window to see if it acts similarly.
[2016-03-17 18:58:44]
User791263 - Posts: 151
You NORMALLY do not get involved in users' auto-trading systems & permutations that could occur.

Since you worked on simulation fills in V1382, consider this a possible exception to your rule.
There seems to be one other bug than only the one I first posted.

Since V1382, I've been testing mostly the same forumlas as just before (which were working,all trades showing up on spreadsheet), which progress I record meticulously for an audit history.

I see what appears a bug in Buy fills sometimes not showing on the spreadsheet, yet ARE on the Trade Activity>Trades Log. The Buy entries occurs as the Formula says to do,but nothing appears for some trades, on the Spreadsheet (about 10% of trades).

No I don't allow an exit in a Buy entry bar. Exits seem to work for most trades, mostly (except for my original post issue above).
But exits do not seem to recognize these Buys that do not get into the K-Column but only in the Log and on the Chart.

All Buy fills show up on the Chart and Trades log.

It seems that the program sometimes fails to post a Buy Entry into the spreadsheet, but doing everything else.

Auto settings are as in the first post.

Yes, it is the correct sheet, as most trades do show up as occur.
No, I have no other trading spreadsheet active to stop or belay a buy signal.

It is very simple, with one chart, one sheet active, one other sheet with nothing in K,L,M,N.

This should be easy for you to test,using any scalping system with 10-second to 1-minute bars that enter often--- to confirm the problem, since only about 10% of orders that appear on the log don't appear on the spreadsheet.
Nor does the spreadsheet "Detail" formula-debug show logic or trues "to buy" for the entry that shows up on the Trades Log.

Could the speed of 60X be an issue where there are 40 charts, 7 spreadsheets, many studies?
Tests are set on ALL Charts, Skip Empty periods, Accurate Trading Back test mode.
This problem is during Replay mode, 1-Sec processing.
Storage is set 1-Sec.
[2016-03-17 19:03:43]
Sierra Chart Engineering - Posts: 104368
I see what appears a bug in Buy fills sometimes not showing on the spreadsheet, yet ARE on the Trade Activity>Trades Log.

This is nothing more than a case where a formula is returning true temporarily causing a trading signal to be given and then later becomes false. This is all.

You need to debug this yourself.
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
Date Time Of Last Edit: 2016-03-17 19:04:00
[2016-03-17 20:35:19]
User791263 - Posts: 151
I was starting to think that "inside the bar" signal change was a possibility. With 10-sec bars, everything happens so fast, it is difficult to tell.

To debug within a bar when using 1-second processing interval on 10-sec bars, can changes in data at 1-sec intervals be observed by setting Replay to very slow, like 0.2 of RealTime ?

I have not watched spreadsheet cells changing within bars at slow speed, but likely it should (each second), right?

Which setting(s) is allowing that, or will it always happen when not going to strict evaluation on bar close?
- Allow Multiple entries same dir
- Allow entry w/ working order
- Support Reversals
- Allow Opposite Entry w/ Opposing Position.

Thanks. I should not need more time on these matters if you can help with those last 2 questions.
[2016-03-17 20:53:46]
User791263 - Posts: 151
Last thought - Question on J-Column data source on Position Quantity/Price, to avoid bad mistakes:

Since auto-trade Exits seem to work only (?) off of the spreadsheet, my "intrabar entry" settings above appear dangerous unless using attached order stops, too, because there is no spreadsheet record of the Buy Entry held.

Is that correct?

"Position Quantity" is the key field. Does that spreadsheet cell populate ONLY from spreadsheet records, or a positions file/log?

If Position Quantity and Last Entry Price fields in J-Column are always correct, regardless of detail Spreadsheet fill records, I can build Exits around the J-Fields and the current bar data?

But since my first post was about $J$8 not Finding a position quantity for intrabar Entries, I may have a major misconception here!

It would seem that $J$8 and Entry Price should come from the same source as the Trade Activity log & chart Orders source.

You all have done some major "inside the bar" work, I understand. This is all crucial for quick scalping, so any thoughts on this will help many of your users (eventually).
[2016-03-17 22:48:01]
Sawtooth - Posts: 3993
Exit formula, to suppress exits when no position
In most cases, it is not necessary to suppress an exit when there are no positions. L and N will not enter a position if you are flat.

With 10-sec bars, everything happens so fast, it is difficult to tell.
Is 'Signal Only On Bar Close' set to No? Historical markers of signals are only at close of bar. You are probably getting a very fast intrabar signal that leaves no marker.

can changes in data at 1-sec intervals be observed by setting Replay to very slow
Maybe. The slowest speed allowed is 0.1, or 1/10 realtime.

Does that spreadsheet cell populate ONLY from spreadsheet records, or a positions file/log?
Column J output values are correct, and can be used reliably in formulas. J8 can quickly go >0 and then 0 without you noticing it, but the spreadsheet will react to it.

Which setting(s) is allowing that, or will it always happen when not going to strict evaluation on bar close?
None of the settings in your list would disallow observing changes as they happen.
The 'Strict Signal Only On Bar Close Evaluation' setting is not used in most cases, and is only used when 'Signal Only On Bar Close' is set to Yes.

Here are the pertinent documentation:
http://www.sierrachart.com/index.php?page=doc/doc_SystemsAlerts.php#DisappearingArrows
http://www.sierrachart.com/index.php?page=doc/doc_AutoTradeManagment.php#AllowMultipleEntriesInSameDirection
[2016-03-18 02:01:45]
User791263 - Posts: 151
I'll reread the documentation.

You answered most questions, but Buy Entries that Fill, but don't then show in the Spreadsheet make it impossible to ever find actual Positions if the intrabar fills don't get posted into $j$8 or the last entry price in J-col.?

Positions on the Trade Window & Positions Window will not agree with the Spreadsheet. I will test that is the case.

Your design properly ignores orders when no position, so Exit formulas can work almost independently, except for the key information of position, or entry price.

You clarifying- confirming that would help everyone.
A good improvement for this problem might be:

Add an Option setting for Spreadsheet Source of Positions & Entry price data, to select from the same source as the TradeWindow & Positions Window for intrabar order settings.
[2016-03-18 14:57:17]
Sawtooth - Posts: 3993
Note: I'm not SC Support; I am only an experienced spreadsheet study user. Since SC Support marked this as User Discussion, I am offering tips/suggestions.

Buy Entries that Fill, but don't then show in the Spreadsheet make it impossible to ever find actual Positions if the intrabar fills don't get posted into $j$8 or the last entry price in J-col.
J8 is realtime; it never holds any prior value. J48 only holds the most recent entry price, but nothing historical.
To see historically the intrabar trades on the spreadsheet, you might try using one of the Trading: ... studies, however, these will only update at close of bar.

Positions on the Trade Window & Positions Window will not agree with the Spreadsheet
I've never found this to be true. Data in these are from the chart occurrences, not the reverse.

What you want to do might not be possible with a spreadsheet study, especially when scalping intrabar on a 10 second chart.
[2016-03-18 15:52:17]
User791263 - Posts: 151
Thanks Tom.
SC might want to capitalize on this, their unique intrabar entry capability, carefully, however. I think they prematurely designate "User Discussion" sometimes.

Clarifying, Tom, I am not exiting within the Buy Entry bar.

I THINK S.C. said that the spreadsheet posts only the end-of-bar (EOB) bar trade-status in the row.
That's what I am seeing and testing.

That is, SC said the spreadsheet will not show the "true" (1) in the row when the end of bar condition is not true, even if it was briefly true and a trade occurred, with my settings.

I see the same in regard $J entries; It seems to follow that same spreadsheet rule.
That is, I see trades happen on my chart and Trade Activity Log>Trades, and appear in top of the Trade Window, but no "1" in the row in which it occurred.

Unless you have my exact settings above, you won't see the true appear, the trade happen,and the "1" not appear at EOB & No Position in J8 (though there IS a position).

Current Position quantity $J$8 obviously reflects the sum of Order quantities per bar from each "true" row, added together, which is correct ONLY if EOB status in K-col is "1".
Because it isn't in this rare instance, $J$8 seems to not match actual positions elsewhere.
I've seen it several times now.
Nor can L-Exits detect it. That's why/how this investigation began (my first post).

In this case, the L-Exit formula can't look back how many rows for entry, or anything but fly manual over-ride via attached orders, or use L-col blind (conditions of current bar).

I've seen it. I know the trade does not get into $J$8. I will verify it in slow-mo this weekend.

S.C.'s advantages include Speed & Flexibility, to instantly get into a trade this way.

So PLEASE, SC, don't "fix it", unless by adding a Trade Spreadsheet setting to choose:

"Update J-Col Positions/Entry price from Actual Trade Log"

and include a new J- field for "Bars since Last Long Entry"

Even smarter would be to do that automatically for my Trading Spreadsheet settings.
If I confirm this, the above will become a Feature Request.
[2016-04-02 01:00:36]
User791263 - Posts: 151
I've had nearly 2 weeks more to study intrabar entries. SC Eng was correct that the true condition goes true then not inside the bar; the trade occurs; no flag is visible.

Tom is right that exits wont exit from flat positions. But the positions are not flat when my settings allow the trades to enter,but a 0 is left in K & M columns though entries occurred.
ie: I'm not flat when those trades do happen but no 1 is in K or M columns.

A trader needs to be able to test how many "bars since entry" (a basic Tradestation function) and that a trade occurred.

An option in Spreadsheet Settings to hold true state, rather than using column H to "lock condition" would be nice.

I'm having trouble understanding the example & modifying the H3 , H4, H5 etc circular references to hold true until L or N go true to reset it.

I saw one example where the user was trying to count times the condition "bars since entry" was true for bars since a certain time, but Tom explained there is no cell available to hold variables.
Too bad. That would be useful.

"Bars since entry" is not crucial, but helpful.
I care what happens within 10- 12 bars of entry, or to know position is older-greater than that.
Mostly I want L & N to be able to test whether K & M were true.

I need to locate-know the bar where true occurred, for debugging-improvements ie: auditing market status at that bar (backtesting).
SC, that is where an option setting would be great-just post a 1 in the row if ever true within the bar.

My intrabar entry requirement may be common, so please,
if not going to add the setting option,

could SC improve (flesh out) the example at
http://www.sierrachart.com/index.php?page=doc/doc_SpreadsheetAdditionalInfo.html#StateLocking

Such Col H method on the example sheet is still cryptic.
Is the text in H3, H5 and H7 supposed to be formulas, such as K3=1 or TRUE?

I don't understant the abstract examples given by SC, Tom & Sawtooth.
How about just use my requirement as the example?
It seems very like SC's existing example, but that one appears incomplete.

Just use a K3 condition like AND(P3<-200,P3>-300. M3 similar.
[2016-04-02 02:07:08]
Sawtooth - Posts: 3993
Working with intrabar entries can be challenging, especially using the spreadsheet study with its limitations.
You might consider stepping up to using ACSIL for a project like yours.

A trader needs to be able to test how many "bars since entry" (a basic Tradestation function) and that a trade occurred.
The only way to do this in a spreadsheet study is to use a formula column to count bars since the previous arrow (previous TRUE), but this precludes intrabar entries because the flag only occurs at close of bar.
The only way to do this in a spreadsheet study with an intrabar entry is to count bars since J42 matched column A, but this only works for the most recent entry, so there is nothing stored historically earlier.

An option in Spreadsheet Settings to hold true state, rather than using column H to "lock condition" would be nice.
This would need to be a new study, possibly an addition to the Trading: ... studies in the list, that would output to a spreadsheet column a 1 in the row where it occurred. I would also welcome this.

To see a flesh-out example of the locking state, have a look here:
http://www.sawtoothtrade.com/example-9.html
But even if you got this to work automatically, if would only be for the most recent entry and there would still be nothing stored historically.
Date Time Of Last Edit: 2016-04-02 02:26:55
[2017-10-06 22:51:34]
User29926 - Posts: 92
Using only one condition to unlock the cell works
=AND(OR(H3=TRUE,H4>1),H5=0)

But adding an additional condition and the unlock does not work anymore
=AND(OR(H3=TRUE,H4>1), OR(H5=0,H6=0) )

Even this write up only uses one condition to unlock:
Spreadsheet Studies Special Tasks: Locking the State of a One Time Condition

Does this unlock feature only work with one unlocking condition?
[2017-10-07 00:30:51]
Sawtooth - Posts: 3993
Does this unlock feature only work with one unlocking condition?
It seems when more than one cell is included in the reset formula, the spreadsheet will not automatically recalculate.

If you go through the steps to lock and unlock, then you go to Spreadsheet >> Recalculate All Formulas, H3 will reset.

Does this work in an active chart with live or replay data? It should.
[2017-10-07 06:19:24]
User29926 - Posts: 92
If you go through the steps to lock and unlock, then you go to Spreadsheet >> Recalculate All Formulas, H3 will reset.

Hi tomgilb,
Thanks for the reply.
Yes, once H4 <1 and the reset procedure is done.
Then manually going to Spreadsheet >> Recalculate All Formulas.
H3 does reset.

However, this lock and unlock cell feature will be used in an auto trader.
There would be 5 different conditions that will cause the cell to reset itself.

If I have to set and watch the multiple spreadsheet cells then manually recalculate the spreadsheet to reset the targeted cell.
That defeats the purpose of having a cell that can reset itself without my interference or constant attention.


Currently there is no way to have a cell recalculate itself or the entire spreadsheet.
Sierra support has stated "No, this is not supported. It is not something that we would add."
Spreadsheet recalulate

I would think that added a built in function to reset a targeted cell or the entire spreadsheet. IE: targeted cell: Recal($H$3) or entire spreadsheet: Recal() .
To their own spreadsheet design shouldn't be that difficult.
Date Time Of Last Edit: 2017-10-07 06:23:13
[2017-10-07 06:52:33]
Sierra Chart Engineering - Posts: 104368

Currently there is no way to have a cell recalculate itself or the entire spreadsheet.
Sierra support has stated "No, this is not supported. It is not something that we would add."
Spreadsheet recalulate

I would think that added a built in function to reset a targeted cell or the entire spreadsheet. IE: targeted cell: Recal($H$3) or entire spreadsheet: Recal() .
To their own spreadsheet design shouldn't be that difficult.

We could support recalculation or resetting of a single cell. But we are afraid of doing the entire Sheet because it is going to get misused and cause problems.

But we need to understand what exactly the function is expected to do in regards to operating on a single cell.
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-10-07 07:34:02]
User29926 - Posts: 92
But we need to understand what exactly the function is expected to do in regards to operating on a single cell.

tomgilb has more knowledge of SC spreadsheets then me.
His input would be of higher quality than mines.

However, I would suggest resetting the targeted cell to a default false/zero Recal($H$3).
Or better, allow the user to supply an optional parameter Recal($H$3,"5").

I have 5 different conditions that would make cell $H$3 reset/recalculate.

So I assume that the cell will need to allow more then one reset/recal condition to occur or allow another cell the ability to target cell $H$3 for reset/recalculation.
Date Time Of Last Edit: 2017-10-07 09:48:31
[2017-10-07 16:04:08]
Sawtooth - Posts: 3993
We could support recalculation or resetting of a single cell. But we are afraid of doing the entire Sheet because it is going to get misused and cause problems.
Actually, a 'Recalculate All Formulas' will release any locked TRUE condition, so recalculating the sheet, or any portion of it, is not the solution.

But we need to understand what exactly the function is expected to do in regards to operating on a single cell.
Use the attached Lock a condition TRUE test.scss to duplicate the issue:
The blue cells (H3-H5) will reset the lock; the yellow cells (H7-H10) will not.

Steps to lock then unlock H3 (this formula references only H5 for a reset):
-enter 2 in H4. H3 will go TRUE
-enter 1 in H4. H3 remains TRUE
-enter 0 in H5. H3 will go FALSE
-enter 1 in H5. H3 is reset/ready to be locked again.

Steps to lock then unlock H7 (this formula references H9 or H10 for a reset):
-enter 2 in H8. H7 will go TRUE
-enter 1 in H8. H7 remains TRUE
-enter 0 in H9. H7 remains TRUE
-enter 1 in H9. H7 is still locked.
attachmentLock a condition TRUE test.scss - Attached On 2017-10-07 16:03:44 UTC - Size: 30.4 KB - 287 views
[2017-10-07 21:02:24]
User29926 - Posts: 92
tomgilb,

I looked at the spreadsheet formula "=AND(OR(H7=TRUE,H8>1),OR(H9,H10))" regarding the yellow cells
Having to wait until H8>1 goes "<--- must me >1 to lock condition, must be 1 before resetting"
I`m confused on that.


This is the actual code that I use in the $H$64 cell of my trading spreadsheet.

=AND(OR( $H$64 =1, IF(AND( $H$90=0,ABS(($H$56 - $H$54)) <= $H$68, SUM(ID64.SG1@3:ID64.SG1@6)),1,0)),

OR($J$8 = 0, OR($H$90= 0,OR ($H$62= 0, OR ($H$50 = 0 ,$H$95= 0))) ))

It locks perfectly and $H$90= 0, unlocks it.
When $H$90 goes to true (1) and back to false(0), $H$64 cell is unlocked and reset to false(0)

But $H$64 cell will never unlock and reset back to zero (0) with more then one unlock reference cell.
The cell needs to unlock whenever either of the 5 referenced cells goes to true(1) and back to false(0) .


This code: IF(AND( $H$90=0,ABS(($H$56 - $H$54)) <= $H$68, SUM(ID64.SG1@3:ID64.SG1@6)),1,0)) happens only once to lock the $H$64 cell.

Are you saying that I Have to wait for it to go back to zero(0) and then back to true(1)again to allow an unlock/reset to occur ???
If so, that will not work for me.

This $H$64 cell is just one of 4 other lockable cells that must be true(1) for a trade to happen.
It may take an hour or more for all the other three cells to go true(1) and lock.

Now, if certain conditions happen during that period of time to any of the four lockable cells(each of these lockable cells have multiple and different conditions that can cause an unlock and reset).

I need to unlock and reset all cells to false(0) that were previously locked.
Effectively resetting all trade entry parameters.


Actually, a 'Recalculate All Formulas' will release any locked TRUE condition, so recalculating the sheet, or any portion of it, is not the solution.

I'm puzzled as to why enabling a user to recalculate a cell in a spreadsheet with a built in function is not a good idea?

Being able to put in cell $H$90: =IF(AND($H$64 = 1,($CU$3 < $CW$3)),Recal($H$64),0)

It would make trying to change a value in a targeted cell when we need to a lot simpler then trying to figure out how to code multiple cells lock and unlock formulas to do so.

Myself and I`m sure others would find it useful.
Date Time Of Last Edit: 2017-10-07 22:43:06
[2017-10-08 00:59:13]
Sawtooth - Posts: 3993
If H4 remains >1, H3 will toggle locked/unlocked as H5 toggles TRUE/FALSE. Forcing the recalc in this situation does not unlock H3. H4 must be <2 before even a 'Recalculate All Formulas' will reset H3. Or follow the process where H4 must be <2, then H5 must become FALSE then TRUE, before H3 is ready to lock again.

Use the blue cells to see manually how it is supposed to work. Automatically unlocking a locked TRUE cell can be convoluted in even simple cases. Forcing a recalc would probably make it more so because you'd have to do it at a certain point in the process.

In my experience, using a locked condition TRUE formula is only needed in rare occasions.

A more reliable solution is to create a persistent variable in a Formula Column.
If you want to discuss this privately, contact me here:
http://www.sawtoothtrade.com/contact.html
[2017-10-09 16:11:22]
User29926 - Posts: 92
SC Support.
Are you working on the cell Recalculation ability or decided to leave the spreadsheet as is?

Thanks.
[2017-10-16 21:45:24]
Sierra Chart Engineering - Posts: 104368
In response to post #20, at this point we are not sure whether this makes sense based upon what Tomgilb is saying.

We are also not sure about the implementation details of doing this:
However, I would suggest resetting the targeted cell to a default false/zero Recal($H$3).

But we will have a quick look at the concept.
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