Login Page - Create Account

Support Board


Date/Time: Wed, 27 Nov 2024 01:54:46 +0000



[Programming Help] - Column K Status Changes and Accuracy

View Count: 622

[2023-09-07 14:35:05]
User772499 - Posts: 48
Hi,

I'm trying to figure out how to get column K to keep a 1 status when the trigger happens and have the trigger (market order buy) occur exactly when the formula is true. The entries are not always happening when they should and are late.

Column O is my signal bar. In settings I have "Signal Only on Bar Close (L,N-Z) set to "Yes". I am very confident these are correct and O4 will be "1" once the signal bar has closed.

For my entry in column K, I want it to buy market the instant price is 1 tick above the SB(O4) high. I have Signal Only on Bar Close (columns K,M) set to "No".

My K3 formula is: =AND(OR(ID5.SG1@3=2,ID5.SG1@3=4),O4=1,E3=C4+$J$21) Basically saying when the current bar price = the SB high +1t, then Buy Market.

Is there a better way to do this so it functions better?

Also is there a way to keep the status of K3 as a 1 once the formula is true? It will flash "1" but change as soon as the price changes.

Thanks!
[2023-09-07 20:19:55]
Sawtooth - Posts: 4120
is there a way to keep the status of K3 as a 1 once the formula is true?
No, it's not possible to make an intrabar event persistent.
Only close-of-bar signals can be made persistent.

Is there a better way to do this so it functions better?
- Make K3 the signal bar.
- Put this in cell J22: =C4+J21
- Set J71 to "S"
- Use one of these examples to cancel the pending order, if unfilled:
Spreadsheet Example Formulas and Usage: Cancel Unfilled Working Order n Minutes After Entry
Spreadsheet Example Formulas and Usage: Cancel an Unfilled Order After n Bars
[2023-09-07 20:49:36]
User772499 - Posts: 48
Thanks Tom but I still can't wrap my head round that.

Nothing happens on the Signal bar. The next bar is the trigger bar where I want a long at 1t above the SB high. So doesn't the SB have to be in row 4 and then the trigger bar in row 3?

If K3 is the SB, C4+J21 is going the wrong way isn't it?
[2023-09-07 21:46:29]
Sawtooth - Posts: 4120
doesn't the SB have to be in row 4 and then the trigger bar in row 3?
If Signal Only On Bar Close is Yes, then the signal needs to be in row 3, and it will be a close-of-bar signal.
If Signal Only On Bar Close is No, then the intrabar signal will be in row 3, and the close-of-bar signal will be in row 4.

The Signal Only On Bar Close only affects Formula Columns, so close-of-bar formulas in column J need to reference row 4.

My understanding is your trigger is the first occurrence intrabar after a previous close of bar signal, correct?
IMO, using a Buy Stop entry is best practice for your situation, and it will do what you want.
[2023-09-08 16:24:24]
User772499 - Posts: 48
"My understanding is your trigger is the first occurrence intrabar after a previous close of bar signal, correct?" Yes!

I updated K3 and set it to Signal on close and setup the buy stop price like you said.

Now I'm getting mixed results. Sometimes I will see the pending buy stop order lines then they immediately disappear, sometimes there is not order sent, and sometimes it works great. In all cases K3=1 on close and K4=1 after close.

I added the cancel pending orders after n bars but disabled it for now.
[2023-09-08 20:43:01]
Sawtooth - Posts: 4120
In all cases K3=1 on close and K4=1 after close.
I suppose it's possible that sometimes the signal doesn't actually exist at the moment of bar close.
Is K3 flashing 1/0 as the current bar builds?

What you want to do is entirely possible, and I've used this type of setup in systems without issue.
But there is not much more I can offer without your chartbook/spreadsheet file.
[2023-09-09 15:32:11]
User772499 - Posts: 48
So after disabling the count bars and cancel after n bars feature, it ran pretty well. Buy stops were being placed at the right price and at the right time. If back to back SBs happened the trade order would not be sent. I was letting the entries trigger then I was flattening the position so it would catch the next one. I found a setting for "reset condition on every bar" and changed it to yes and that fixed that problem.

K3 does toggle 1/0 while it's the current bar and if it closes with the conditions met K4 is "1". The K alert arrows come and go until the close of the bar. Btw, is there a way to offset the location of the K alert arrow so it's not as close to the low of the bar? I don't see a setting for this.

Next week I'll work on the Order cancel after n bars feature. It would be a nice feature to have to not have to manually cancel if the trigger isn't hit.

Thanks for all your help!
[2023-09-09 15:44:12]
Sawtooth - Posts: 4120
is there a way to offset the location of the K alert arrow so it's not as close to the low of the bar?
Try this:
K3:
=IF(YourBuyEntryFormula,D3-$J$21*2,0)
M3:
=IF(YourSellEntryFormula,C3+$J$21*2,0)

This will offset the arrows by 2 ticks.

This returns a price instead of a 1, and it works because any non-zero is a TRUE.
Date Time Of Last Edit: 2023-09-09 23:11:07
[2023-09-09 16:20:24]
User772499 - Posts: 48
Awesome thanks, will try it.
[2023-09-13 15:15:13]
User772499 - Posts: 48
Is there a place to enter a commission for Sim so J45 (Closed Daily P/L) is more accurate?
[2023-09-13 18:47:53]
Sawtooth - Posts: 4120
Is there a place to enter a commission for Sim so J45 (Closed Daily P/L) is more accurate?
No, but there's this:
Spreadsheet Example Formulas and Usage: Calculate Daily Net Closed Profit/Loss After Commissions
[2023-09-13 19:31:04]
User772499 - Posts: 48
That works!
[2023-09-13 21:24:08]
User772499 - Posts: 48
I'm using that calculated P/L (cell H41) to determine trade quantity. Basically if the P/L is between A and B trade 1, if it's between C and D trade 2, etc.

So in cell J26 for Qty where I have the formula, I get #ARGS!

If I override the H41 formula and type in a small number, the J26 formula shows the correct qty. If I use a larger number I get the #ARGS!

I put all the formulas on a regular spreadsheet to test it out and it works fine for any number in H41.

Is this a number format issue or some other issue?

Thanks!
[2023-09-13 22:26:06]
Sawtooth - Posts: 4120
Show me the exact formulas in J26 and H41 please.
[2023-09-14 12:28:51]
User772499 - Posts: 48
J26 is =IF(AND(H41>=H48,H41<=H49),H50,IF(AND(H41>=H51,H41<=H52),H53,IF(AND(H41>=H54,H41<=H55),H56)))

H41 is =J45-J53/2*4.58

H48,H49,H51,H52,H54,H55 are the inputs for the different P/L levels

H50,H53,H56 are the quantities for J26


Thanks,
[2023-09-14 13:54:22]
Sawtooth - Posts: 4120
You need a final 'else' in the formula:
=IF(AND(H41>=H48,H41<=H49),H50,IF(AND(H41>=H51,H41<=H52),H53,IF(AND(H41>=H54,H41<=H55),H56,FinalElse)))

When H41 > H55, it doesn't know what to do.
[2023-09-14 14:31:41]
User772499 - Posts: 48
Ok that makes sense.

Thanks again!
[2023-10-05 20:02:45]
User772499 - Posts: 48
"My understanding is your trigger is the first occurrence intrabar after a previous close of bar signal, correct?
IMO, using a Buy Stop entry is best practice for your situation, and it will do what you want."


The Stop in entries worked great in Sim but after testing this out on my live acct I found I get a lot of rejected orders. I think price moves to fast and is above the buy stop price by the time the order is sent.

in J22 I have: C4+J21 and J71 is: S

Is there a way to ensure the orders go thru all the time?


Thanks,
[2023-10-05 20:39:45]
Sawtooth - Posts: 4120
Is there a way to ensure the orders go thru all the time?
You would think a Stop Entry would fill at Market if the market is beyond it.
The rejected order must be a limitation from the exchange. Ask your broker.

What is the rejection message in the log?
[2023-10-06 13:51:23]
User772499 - Posts: 48
Rithmic Direct - DTC (Order reject). Info: buy order stop price must be above trade price. Internal Order ID: 3329. Service Order ID: 100793435. Symbol: ESZ3.CME. Account: PRACTICEOct62120155 | 2023-10-06 09:48:41.217 *
Rithmic Direct - DTC (Order reject). New order rejected by server. Internal Order ID: 3329. Service Order ID: 100793435. Symbol: ESZ3.CME. Account: PRACTICEOct62120155 | 2023-10-06 09:48:41.217 *
[2023-10-06 14:37:23]
Sawtooth - Posts: 4120
Is there a way to ensure the orders go thru all the time?
Try this in cell J71:
=IF(E3>=J22,"M","S")

I'm not sure this will make any difference.
If not, you'll need to revert to a Market entry when E3>=C4+J21.
[2023-10-06 14:55:16]
User772499 - Posts: 48
Thanks will try it.
[2023-10-06 20:24:09]
User772499 - Posts: 48
Well...=IF(E3>=J22,"M","S") didn't work in J71 so I tired =IF(E3>=C4+J21,"M","M")

It would execute but it triggers on the very 1st tick even if it's a matching high or 1t lower. It doesn't wait to see SB high +1t.


I think that's what it was doing before you had me change to the Buy stop method (which worked great on SIM). I get rejected orders when I tried my live AMP acct and a prop acct practice acct.

I'm also now using Order Allocation to link 3 accts together but I don't think that's causing any trouble and seems to be working fine.

Any other thoughts on this?
[2023-10-08 01:51:54]
Sawtooth - Posts: 4120
This: =IF(E3>=C4+J21,"M","M") equals this: M
because it is M in both situations.

Try this in K3:
=AND(YourOtherEntryConditions,E3>=C4+$J$21)
-Set J71 to M, and remove any formula in J22.
-Set Signal Only on Bar Close (columns K,M) set to Yes.
-Don't use column O for your trigger.
[2023-10-09 15:16:44]
User772499 - Posts: 48
Tried that but it didn't work. I modified it and have this now. O isn't my trigger it's the closed bar that is by my definitions the Signal Bar. So nothing happens until the next bar (current bar) is 1 tick higher than the SB.

O is =AND(Is a bull bar, Bar size not too small, Bar size not too big,OR(Bar is Type 1,2,3,4,5,or 6)) This works perfectly every time
K is =AND(Other reasons for long and O4=1, And price is >=C4+$J$21)

Signal Only on Bar Close (K,M) is "No"

The spreadsheet study is dead last in my list of studies (not sure if that is critical or not)

Running this today some entries are executing perfectly and others seem delayed and some don't execute at all.

I'm going to keep running this all day (not on SIM) to see how it does. I might be at the end of what I can do with this. I'm getting frustrated and just want to trade with it!

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

Login

Login Page - Create Account