Login Page - Create Account

Support Board


Date/Time: Fri, 26 Apr 2024 10:20:17 +0000



[Programming Help] - Trading System: Study Sub-Graph Crossover and OCO Attached Orders

View Count: 1955

[2020-07-08 04:00:07]
ondafringe - Posts: 248
I use OCO orders on all my trades. Past trades have been manually executed and the Attached Orders have been automatically placed without issue based on the order I have selected in the Trade Window.

I've been exploring the "Trading System: Study Sub-Graph Crossover" After adding and configuring that automated crossover system, when the Crossover occurs, an order is placed, as expected, but only for 1 contract (OCO order selected in Trade Window was for 2 contracts)... it goes Long or Short, as expected; however. it will not place the Attached Orders based on the OCO order I have selected in the Trade Window. It seems to be placing a default order for 1 contract with no Stop or Target.

"Use Attached Orders" is checked. Trade Activity Log shows no rejects or errors, but indicates only the Parent Order was placed for 1 contract (should have been 2 contracts). No Attached Orders are indicated in the log until I manually attach by position.

Haven't found anything in the documentation (yet) that appears to address this issue. Am I missing a setting somewhere?
Date Time Of Last Edit: 2020-07-08 14:06:43
[2020-07-08 19:56:07]
Sierra Chart Engineering - Posts: 104368
The most likely reason is that you are not using the correct Trade Window for that symbol. Refer to the information here:
Basic Trading and the Trade Window: Trade Window Settings Not Applying to Chart or Trading DOM
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
[2020-07-08 21:18:44]
ondafringe - Posts: 248
I think that was *part* of the problem.

So I deleted my Trade Window/DOM and reopened it from the chart... went into SIM mode... set up the Subgraph Crossover Study to give me relatively fast crossovers... set it to reverse on crossover... had my OCO order selected (2 contracts, both with 3 point stop, 1 with 5 point target, 1 with 10 point target)...

On first crossover for Long position... it went Long, but only traded 1 contract with 5 point stop and 10 point target... on second crossover, which should have reversed to a Short position... it didn't do anything... it just remained Long.

I know the OCO order is configured correctly because when I manually attach based on position, or I place the order from the Trade Window, the order is placed correctly.

As I recall, in a past-deleted OCO order, I used to have a 1 contract OCO with a 5 point stop and a 10 point target, and the way it was named put it at the top of my OCO list. It's almost as if SC is somehow retrieving/remembering that old, deleted OCO order and using it instead of using the order selected in the Trade Window, crazy as that sounds.
[2020-07-09 01:38:00]
ondafringe - Posts: 248
I've now... deleted my Trading Window/DOM... deleted my chart... deleted my pre-configured OCO orders... saved all... restarted PC... restarted SC... created a new chart... opened Trading DOM for chart... created a new OCO order (same as described in above comment for 2 contracts) and selected that order in Trade Window... added two studies to chart... added Trading System Study Crossover to chart... and...

As before, the Crossover system is working because it puts Buy/Sell markers on the chart. Upon crossover, Buy or Sell (Long/Short) order is placed correctly, but...

It still only places order for 1 contract when it should place order for 2 contracts. At least now, it does not add the 5 point stop and 10 point target, but it still doesn't attach the OCO orders. However, it does reverse direction every time there is a crossover, but again, upon reversal, it still only trades 1 contract, instead of 2.

And if I manually add Attached Orders by Position, that kills the auto trading and nothing else happens on subsequent crossovers.

I've been on this for two days with no luck. I have no clue as to what's going on.
Date Time Of Last Edit: 2020-07-09 01:38:35
[2020-07-09 11:26:15]
bradh - Posts: 854
Did you check the Maximum Position Allowed setting in the Trading System - Subgraph Crossover study settings? The default is 1.
[2020-07-09 13:10:03]
ondafringe - Posts: 248
Hey, Brad...

Max position is set to 1, which, if I understand that correctly, just means it won't put me Long again if I'm already Long and vice versa.

The weird thing about this is that SC resurrected an old OCO order that had been deleted... and was using it to place the 5 point stop and 10 point target from my earlier issue.

And now, SC is completely ignoring the order selected in the Trade Window and using some default. If I can find where that default setting is, I might get some clue as to where the problem is.

Something's not right somewhere...
Date Time Of Last Edit: 2020-07-09 14:12:11
[2020-07-09 15:41:56]
bradh - Posts: 854
Max position is set to 1, which, if I understand that correctly, just means it won't put me Long again if I'm already Long and vice versa.

That is not what that means. Click on Description in the study settings:

Maximum Position Allowed: This defines the total quantity of a Position that can be opened by this trading system. This number must be equal to or greater than the Order Quantity or the trading system will not place the order.
[2020-07-09 16:46:26]
ondafringe - Posts: 248
Okay... I switched to SIM Trading... set the Max Position to 10 and tested it.

No change. Still ignores the 2-contract OCO in the Trade Window... only trades 1 contract... and no attached orders are placed.

I'm beginning to wonder if this is a SIM trading issue.
Date Time Of Last Edit: 2020-07-09 16:47:58
[2020-07-09 17:12:11]
ondafringe - Posts: 248
I think I have it figured out. Should know what's going on shortly.
[2020-07-09 20:21:10]
ondafringe - Posts: 248
Partially solved...

Under the File menu, when you open Trading DOM for chart, it also opens a Trade Window that is attached to the chart DOM. You would think that was also the Trade Window for the chart, but think again.

There is another selection under the Trade menu to open Trade Window for chart. That opens a new Trade Window, separate from the DOM Trade Window, and this new Trade Window is the real Trade Window for the chart. Apparently, the Trade Window attached to the DOM, which is the DOM for the chart, is the Trade Window for the DOM only and is completely ignored when using the Trade System study.

Once I opened the Trade Window for the chart, upon a crossover, the correct trade was placed for 2 contracts and the attached orders were also placed correctly. That real Trade Window for chart must remain open at all times for the Trades System to function. So now I think I'm home free, but no such luck.

Once in a position, upon the next crossover, even though I have Reverse on Crossover selected in the Study setting and have 20 set for Max Position, nothing happens, there is no reversal.

Now if I can just get the non-reversal problem solved...

@Brad Your suggestion on Max Position was correct. Thanks!
Date Time Of Last Edit: 2020-07-09 20:40:18
[2020-07-10 00:37:54]
ondafringe - Posts: 248
Maybe there's a setting somewhere I missed. But that's it. I'm throwing in the towel.

This is an SC-provided Trading System study. This is not something I'm programming, so not sure why SC moved this to Programming Help.

The study only has a handful of setups. If I indicate that I want to "Reverse on Crossover when in a Position," then it should reverse my position on all crossovers except for the very first entry. It does not.

There is nothing in the documentation for this study to indicate anything else is needed. You can see that here:

Trading System - Study Subgraph Crossover

I even set the Max Position size to 30, just to make certain there was plenty of wiggle room.

Since the documentation for this Trading System study failed to mention there are two different Trade Windows for the same chart, but only one works with auto-trading, I suppose something was also left out of the documentation for the Reverse on Crossover when in a Position setting.
[2020-07-10 02:16:10]
Sawtooth - Posts: 3976
it should reverse my position on all crossovers except for the very first entry
Yes it should, but it only reverses at every crossover if you uncheck 'Use Attached Orders', based on my test.

Note: The Trading DOM and the Trade Window are two different things. The Trading DOM is actually its own chart, with a Trade Window that is automatically attached.
You can open a Trade Window for any chart. You would need to initially do this so you can set the Order Quantity and the TW Config you want to use, and other settings. You could then remove the Trade Window if you want (I do not recommend you remove it) and if you or and autotrader enters an order, it will remember what you chose . So if you got different functionality with no Trade Window open, you were accessing the TW settings the last time it was attached.

I'm throwing in the towel.
My recommended way to create a crossover autotrader is to use the Spreadsheet System for Trading study. It's not as easy as the Trading System - Study Sub-Graph Crossover study, but it is reliable. Plus it has so many more options and abilities. With a simple crossover using reversals, you'd only need 2 simple formulas, and a few setting changes.
[2020-07-10 02:49:43]
ondafringe - Posts: 248
I knew it. Another critical piece of information left out of the documentation. Oh, well... I suppose with software this complex, some things are bound to fall through the cracks! :)

Yes, After a day and a half of beating my head against the wall, I learned the Trade Window on the chart DOM isn't the Trade Window for the chart!

Note to SC: It would be a good idea to put both these things in the documentation for this study.

Thank you... thank you... Tom for your assistance. Guess there's no avoiding the spreadsheet learning curve now! :)

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

Login

Login Page - Create Account