Automatically Adjusting Limit Order

Login or Register

Please login or register in order to view and post in the Forum.

5 posts / 0 new
Last post
Mickster
Last seen: 3 years 6 months ago
Joined: 06/29/2018 - 17:47
Automatically Adjusting Limit Order

I would like to automate a trading setup that I currently implement manually. When price moves down and hits a moving average, I would like to execute a buy limit order at the moving average price.

Currently, when price starts to move towards the moving average, I set a limit order at the moving average price. However, as price continues to move downward towards the moving average, the moving average level is also falling, making it necessary to continually adjust the limit order in the DOM to the moving average price.

I do not care about backtesting - I only want to send a live order to the broker (Gain). Ideally I want this order to be a bracket (OCO) order, however, I realize that this function is not yet available for Gain.

What is the best way to implement this?

Thanks.

0
cpayne
Last seen: 1 year 8 months ago
Joined: 03/30/2009 - 00:00
Reverse Enginner Indicator

Import this chart...

https://www.linnsoft.com/charts/revengclosemeetsmovavg-es

I've used the Reverse Engineer indicator in order to project where the price must move in order to meet the moving average.  In this case, I'm actually using a Custom Indicator with syntax...

RENG

And the reason I'm using a CI is so I can set the result into a C# or V# variable (which we can use as the limit order price).

Below are the Reverse Engineer settings...

and the Custom Indicator within RENG is setup as....

MA - CL

and the Indicator value we are looking for is 0.  So when MA - CL = 0, we know our MA has met our CL.   And the Engineered Price is set to Close so the result is the closing price needed to achieve this meeting of the CL and MA.  Very powerful indicator when used properly.

So that gets our price into a V# or C# variable.  Now the next step is updating the order price as each bar begins.  It is only necessary to adjust the limit price once / bar as this value will not change intra-bar. 

Mickster
Last seen: 3 years 6 months ago
Joined: 06/29/2018 - 17:47
Hi Chad - Happy New Year.

Hi Chad - Happy New Year.

The link you provided comes back to this page - it does not link to a chart.

I am curious to see how the solution works and if it will allow setting a buy limit order at the exact level of the moving average. When I tested this concept as a trading system, the performance drops off quite a bit when front running or entering late by even a tick. The level is very responsive.

Thanks for the help.

cpayne
Last seen: 1 year 8 months ago
Joined: 03/30/2009 - 00:00
Link Fixed

I have corrected the link in the post above.

https://www.linnsoft.com/charts/revengclosemeetsmovavg-es

Mickster
Last seen: 3 years 6 months ago
Joined: 06/29/2018 - 17:47
Thanks - I was able to get

Thanks - I was able to get the chart and see what the RENG feature is doing.

The goal is to create a trading system that places a buy limit order (intrabar) at the value of the MA, which is changing (falling) as price approaches from above. I can see that the RENG target ref line is tracking the current value of the MA. But couldn't the same thing be accomplished by just recording the MA value into a V# variable and then have the trading system place a limit order at the V# variable price? The limit order should be adjusted in real time as the MA value changes. The order is triggered when the low of the bar equals the MA price. Is this possible to do with the trading system tools?

Also, it is desired to place this order as a bracket order with one stop and one target. Is this possible today with Gain, and if not, is there another data platform that can be substituted?