Login Page - Create Account

Support Board


Date/Time: Fri, 03 May 2024 16:29:26 +0000



[Programming Help] - Help with spreadsheet EXIT - ( close all remaining )

View Count: 1821

[2018-05-22 13:48:49]
User651753 - Posts: 77
I currently have a spreadsheet system working with entry correctly

it will enter 2 Contract @$300

if it starts going agents me it will check if the original requirements matches - it will open another position 2 @ $200 ( so on until it hit the max contract limit)

So now I have 4 contracts with avg price of $250



so L3 and N3 are
```=if($j$9>0,1,0)```
J23 and J25 ( H3 has profit target of $20 )
```=if(J8>0,Mroundown(j9+h3),0)```

The spreadsheet work at the avg price I have to enter ... and place a limit order now at $20 higher than my average entry at $250

however, because I am using J26 with a contract of 2 ... it will only place a limit (take profit) of 2 contracts @ $270

leaving another 2 contract open.

How can I make it close all 4 contract at $270 leaving me with ZERO contract open?

( same goes for if it then buys 2 more contracts at $100 now my avg price is $200 i want to sell all 6 at $220)
[2018-05-22 14:20:26]
Sawtooth - Posts: 3992
J26 is used for both entry and exit order quantities, unless you use J82/J83 to separate them.

You can also use J29 to flatten (instead of L3/N3).
[2018-05-22 14:54:25]
User651753 - Posts: 77
thanks for the help

is this right, or can i use =$j$8 of both

j82 = true

J83 = use and balance =J8
[2018-05-22 15:09:40]
Sawtooth - Posts: 3992
J82=1 turns on separate exit order quantities.
J83 contains the formula that returns the exit order quantity.
Date Time Of Last Edit: 2018-05-22 15:20:07
[2018-05-23 02:26:49]
User651753 - Posts: 77
It looks like it playing step. How could I get it to cancel exiting exit then replace the 2 exit with 4 exits

atm it placing 2 contracts .... then placing 2nd order of 4 contracts ( even tho I only have 4 contracts it has 2 order with 6 contracts)

side question,
my study trigger an order every 1 hour if condition it correct.
Is there a way I can get it to remove older then stay 4 hours old or new order replace old order?

last night it had 12 x 1 hours were correct place order way below index price waiting for a wick down. but I don't want to leave 12 orders.
if i use max contract it just stops placing new order and just leave the old order
[2018-05-23 02:43:22]
Sawtooth - Posts: 3992
You'll need to use J27 or J78 to cancel working orders.

But canceling and replacing working orders will be difficult to do with a spreadsheet study, and even more so when you want to cancel/replace multiple working orders. It's not possible to cancel only one of the orders, and you'll probably need to replace them one at a time in successive bars. In most cases, this is not viable. IOW, you may have exceeded the functional limits of a spreadsheet study.
[2018-05-23 04:06:22]
User651753 - Posts: 77
in a past post, you mention that you can use this

Last Entry/Exit Order Price (read-only) companion to the J90 Last Entry/Exit Order Date-Time (read-only). Would you consider adding this output to the Spreadsheet System for Trading study?
@tomgilb

How can you make it so it cancels all order after last order date-time j90

So i am guessing I need to use Spreadsheet Example Formulas and Usage: Cancel Unfilled Working Order n Minutes After Entry

but place the close all with the working order in j78
[2018-05-23 04:25:26]
User651753 - Posts: 77
p3= =FRACTIME ($J$90)
H4 = 3 ( 3 min)

p78 = Does this work?

=OR(AND(J4 > 0, FRACTIME(J41) - p3 >= H4 / 1440), AND(J4 < 0, FRACTIME(J41) - p3 >= H4 / 1440))
[2018-05-23 04:31:18]
User651753 - Posts: 77
This doesnt work , p3 doesnt change ?? any help

so have
h4 = 3

p3= if(p4=h4,0,p4+1)
p78 = if(p3=h4,true,0)
Date Time Of Last Edit: 2018-05-23 06:19:47
[2018-07-24 12:12:35]
User651753 - Posts: 77
HI tom , could you let me know if this work work ?

if i have = a3=j90 it give me a factime of 0.00003400 how do i get that to show in minutes
[2018-07-24 13:54:21]
Sawtooth - Posts: 3992
0.00003400 is less than 1 minute. It's slightly less than 3 seconds.
1 minute = 1/1440 = 0.00069444
1 second = 1/86400 = 0.00001157
2 seconds = 2/86400 = 0.00002315
3 seconds = 3/86400 = 0.00003472

This displays =0.00003400 in seconds:
=0.00003400/(1/86400)
which equals 2.93760000

This displays 0.00003400 in minutes:
=0.00003400/(1/1440)
which equals 0.04896000
[2018-07-25 03:10:59]
User651753 - Posts: 77
=0.00003400/(1/1440) bingo that what i needed thanks heaps

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

Login

Login Page - Create Account