"Staging" orders for predicted signal

Questions about MultiCharts and user contributed studies.
User avatar
ZaphodB
Posts: 64
Joined: 12 Feb 2019
Has thanked: 20 times
Been thanked: 2 times

"Staging" orders for predicted signal

Postby ZaphodB » 12 Jun 2020

I am trying to refine my entries and also realizing the shortfalls of backtesting vs reality when it comes to actual fills. As we know, the biggest aspect of whether your order gets filled (when trading does occur at your desired price) is who got their orders in first at the desired price. Is there a simple way to solve for the future price that triggers your trade signal using MC? Let's use a SMA to keep it simple and say your strategy goes short when the price exceeds the 2 std dev up band and exits when it passes the 2 std dev down. You're using a length of 20. Is there a way to take the known previous 19 closes and solve for the minimum 20th (future) close which will cause the price to exceed your trading threshold (bollinger band in this case) and place a limit order at that minimum price so if the price does indeed exceed your threshold you will be earlier in line to be filled? Below is an example with normal calculations, but I want to make a version of this that predicts that minimum price increase needed from current price to induce a signal and get that order in ahead of time. The close of the 20th future bar will not only decide whether a threshold is crossed but also what that threshold is so it gets a little tricky.

Code: Select all

Variables: SMA (0) , SDev (0) , NumberStdDevs (0) ; //Normal Calculations SMA = Average (Close, 20) ; SDev = StandardDev (Close, 20) ; NumberStdDevs = (Close - SMA) / SDev ; //Normal Orders If NumberStdDevs > 2.0 then sell short next bar at Close Limit ; If NumberStdDevs < -2.0 then buy to cover next bar at Close Limit ;

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

Re: "Staging" orders for predicted signal

Postby TJ » 12 Jun 2020

You can try a price projection.

Image
Attachments
projection.jpg
(16.8 KiB) Not downloaded yet

User avatar
ZaphodB
Posts: 64
Joined: 12 Feb 2019
Has thanked: 20 times
Been thanked: 2 times

Re: "Staging" orders for predicted signal

Postby ZaphodB » 12 Jun 2020

Are you able to provide an example with code? I am unable to find anything about price projections in the Easy Language manual or MC knowledgebase. I know this could be done with some longwinded mathematical formulas that solve for X but I didn't know if there was an easier way to do it with MC.

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

Re: "Staging" orders for predicted signal

Postby TJ » 13 Jun 2020

You can start here:

Post #6. Developing Your Strategy
viewtopic.php?t=11713

Mydesign
Posts: 177
Joined: 15 Feb 2017
Has thanked: 32 times
Been thanked: 39 times

Re: "Staging" orders for predicted signal

Postby Mydesign » 17 Jun 2020

Hi,

I'd suggest you have a look at the Linear Regression fucntion. It has the ability to calculate its future projection.

User avatar
ZaphodB
Posts: 64
Joined: 12 Feb 2019
Has thanked: 20 times
Been thanked: 2 times

Re: "Staging" orders for predicted signal

Postby ZaphodB » 17 Jun 2020

Hi,

I'd suggest you have a look at the Linear Regression fucntion. It has the ability to calculate its future projection.
Thanks so much, I'll take a look


Return to “MultiCharts”