Support Board
Date/Time: Tue, 21 Jan 2025 04:16:09 +0000
[Programming Help] - Spreadsheet question . place limit order if not fill market order
View Count: 1130
[2018-07-19 10:27:10] |
User651753 - Posts: 77 |
I am trying to use the spreadsheet order to place a limit order if it hasn't been filled in X Time ( 15 min or 15 x 1 min candle) cancel the order and market open example = 1 min chart
P3 = Count since the first trigger buy order J71 = if(p3=15,"M","L") spreadsheet setting "Reset condition on new bar" = YES I kinda got it to work - however, I place an order $2 lower than current Bid price, every min it deletes and replaces a new order at a NEW price $2 from the candle open price after 15 x 1 min candle it will change the 16th order as a market buy if I turn off "Reset condition on new bar" = NO - it will only place the first order, leaving it there ( doesn't market buy) i have also tried adding canceling all order on the 16th candle with J78 = if(p3=15,1,0)
How could i get it to do the same thing, just leave a buy order for 15 min, on the 16th min replace that order with a market order? |
[2018-07-19 13:17:43] |
Sawtooth - Posts: 4157 |
Have a look at these two examples: 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 You'll probably need to use a Formula Column other than K,M for the minute or bar count, then use an OR statement in K,M to include the market entry. |
[2018-07-20 04:12:06] |
User651753 - Posts: 77 |
thanks for the reply tom, I have alread manage to get it to cancel, but when you use spreadsheet setting "Reset condition on new bar" = YES if you dont use it , it wont place a new order after the 1st order has been canceled, if you do use it , well it replaces every order each bar |
[2018-07-20 05:40:21] |
Sawtooth - Posts: 4157 |
Assuming 'Signal Only On Bar Close' is Yes, and you are using 1 min bars, your K3 formula would look something like this: =OR(limitordercondition,AND(P3=16,$J$4>0)) Column P will start an incrementing count from 1 when the Limit order is placed. Column K will have a 1 at the Limit entry, then zeros until P3 is 16 where it will have a 1 again. The unfilled Limit order is cancelled in the 15th bar, and the Market order is placed at the open of the 16th bar. Obviously I haven't tested this, but this is the concept. Date Time Of Last Edit: 2018-07-20 05:41:24
|
To post a message in this thread, you need to log in with your Sierra Chart account: