Modeling Limit order fills in an indicator  [SOLVED]

Questions about MultiCharts and user contributed studies.
User avatar
joebone
Posts: 175
Joined: 05 Sep 2018
Has thanked: 53 times
Been thanked: 4 times

Modeling Limit order fills in an indicator

Postby joebone » 25 Aug 2021

I am trying to model limit order fills in in an indicator
I have been struggling to get it right.

As a prerequisite, the indicator and signal only updates at end of bar and there is no intrabar order generation on the signal.

I have a strange question if someone could help me out. Because I have been getting false positives and false negatives.

Functionally, A limit order buy next bar "limitprice" Limit will be initiated at the end of the current bar and is like putting an order on close[-1] and waiting for it to get filled.

So should I calculate my entire indicator on C[1] then see if it fill on C to properly model a limit fill?

User avatar
TJ
Posts: 7742
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: Modeling Limit order fills in an indicator

Postby TJ » 25 Aug 2021

I am not sure if I understand what you are getting at.

Allow me to explain the process.

[IntrabarOrderGeneration=false]

At the end of the bar (EOB), MultiCharts will calculate your trading logic,
if your trading criteria is met, your order will be sent. (ie next tick will be the opening tick of next bar).

User avatar
joebone
Posts: 175
Joined: 05 Sep 2018
Has thanked: 53 times
Been thanked: 4 times

Re: Modeling Limit order fills in an indicator

Postby joebone » 25 Aug 2021

I am not sure if I understand what you are getting at.

Allow me to explain the process.

[IntrabarOrderGeneration=false]

At the end of the bar (EOB), MultiCharts will calculate your trading logic,
if your trading criteria is met, your order will be sent. (ie next tick will be the opening tick of next bar).
Thanks for the reply TJ. your always around to help.

Let me try to explain better.

If I want to Model the fill of a limit order for a signal in an indicator then what would be the best way to do it?

------------------------
[IntrabarOrderGeneration=false]

At the end of the bar (EOB), MultiCharts will calculate your trading logic,
if your trading criteria is met, your order will be sent. (ie next tick will be the opening tick of next bar).
------------------------

So at the beginning of the next bar (given that all my conditions are met) a limit order will go to the market and stay static for that entire bar. Then update again after that bar for the next bar using the calculations from the bar that just formed.

So if i wanted to simulate a limit order fill in an indicator I could calculate my entire signal on OHLCV[1] and see if the current bar fills it?

would this be correct?

for some context I am trying to track the PnL of a signal that I am not trading for observation purposes.

User avatar
TJ
Posts: 7742
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: Modeling Limit order fills in an indicator

Postby TJ » 25 Aug 2021

. . .
So if i wanted to simulate a limit order fill in an indicator I could calculate my entire signal on OHLCV[1] and see if the current bar fills it?

would this be correct?

for some context I am trying to track the PnL of a signal that I am not trading for observation purposes.
I don't understand your [1] reference on the OHLCV.

If the HIGH and LOW of the subsequent bar straddles your order price, you should be filled.

You can check here for useful articles:
viewtopic.php?t=10811

User avatar
joebone
Posts: 175
Joined: 05 Sep 2018
Has thanked: 53 times
Been thanked: 4 times

Re: Modeling Limit order fills in an indicator

Postby joebone » 25 Aug 2021

. . .
So if i wanted to simulate a limit order fill in an indicator I could calculate my entire signal on OHLCV[1] and see if the current bar fills it?

would this be correct?

for some context I am trying to track the PnL of a signal that I am not trading for observation purposes.
I don't understand your [1] reference on the OHLCV.

If the HIGH and LOW of the subsequent bar straddles your order price, you should be filled.

You can check here for useful articles:
viewtopic.php?t=10811

Ok thanks for the help. I will take another look at it and see if I am making it too complicated

User avatar
joebone
Posts: 175
Joined: 05 Sep 2018
Has thanked: 53 times
Been thanked: 4 times

Re: Modeling Limit order fills in an indicator  [SOLVED]

Postby joebone » 26 Aug 2021

I don't understand your [1] reference on the OHLCV.

If the HIGH and LOW of the subsequent bar straddles your order price, you should be filled.

You can check here for useful articles:
viewtopic.php?t=10811
Just wanted to finish this off.... I was thinking in reverse. Trying to move the entire indicator back one then see if it fills on current bar instead of just cheking to see if a limit would fill with send_order_Condition[1] . Your solution was way simpler. thanks for giving the thread a look.. i was being silly.

User avatar
TJ
Posts: 7742
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: Modeling Limit order fills in an indicator

Postby TJ » 26 Aug 2021

I am glad you've got it working.
Thanks for the update.


Return to “MultiCharts”