Grid Buy Strategy

Grid Stop Buy
v 1.0. beta ‐ April 2010 ‐ To be implemented before using it with real money.

This strategy is inspired by the "Grid Trading" methodology (details can be found on web) , more often used for forex trading.
The code is only suitable for the buy side, while the sell side should be reversed and still to be coded.

Strategy:
The grid trading strategy uses two sub‐accounts (one for buy side and one for sell side) to enter a series of stop orders (grid) at pre‐determined levels, each at the same distance level.
Once in position, the order has a take profit already incorporated (usually at or near the next buy order).
Target of this technique, when used in conjunction with the sell side, is to profit on any market movement inside the grid.

Code:
The code creates 21 buy stop orders above the "Start Level" price, that must be set above 1.

The "Steps" value defines the distance of the stop orders and must be set as number of ticks.

The "TP" (take profit) could be set at the same "Steps" value (original grid trading version) or could be chosen on a different level.

Once in position, the code does not generate any further entry on the same level, until the original order is not closed (profit target), this is done to prevent multiple orders/position on the same price.

When positions are closed (this means buy and take profit) a new stop order is placed when the price re‐enter below the single zone level (see images).

Code is completely free to be implemented but I'd rather prefer, for any modification from the original, to be shared here and become available to anyone.

Possible implementation could be:
‐semplification of some code rows (I'm not a C# expert, so, probably many lines could be recoded more easily).
‐an indicator could be added to show grid price levels.
‐I've seen trouble on some stop orders entry when price hits precisely the level, sometime the order is cancelled instead of executed. Reason could be in the way the levels are calculated and this must be explorated and tested deeply.
‐ See if superimposition of new buy entry and previous take profit level could be avoided (sometime there are some).

Hope this could be useful and become something tradable for people interested in this methodology.

Try this on real market on simulation account for testing purpose. Any comment is welcome

P.S. I'm Italian and apologize if my English not always is so clear.

Created By MAX
NinjaTrader Version 7
File Size 3.2 KB
Create Date(s) 07/14/2010
# of Downloads 2142

Importing to NinjaTrader 7 is Easy!

To import your 3rd party app or add-on to NinjaTrader, simply follow these 3 steps:

  1. Download the app or add-on file to your desktop
  2. From the NinjaTrader Control Center window, select the menu File > Utilities > Import NinjaScript
  3. Select the downloaded file from your desktop

Questions?

Visit the NinjaScript File Sharing discussion in the NinjaTrader user forum to interact with fellow traders and the NinjaTrader support team.