MA filter: how to take the crossover bar?
Author: Stigell
Creation Date: 6/11/2016 1:30 AM
profile picture

Stigell

#1
Hello

I would like to add a very simple filter to the normal fast/slow MA system.

How do I take the High of the crossover Bar and keep it as entry point as long as the fast MA stays above the slow MA?

In tradestation it is something like this...

If Fast crosses above Slow Then EntryLevel=High;
If Fast > Slow then Buy ("long") next bar at BuyStop Stop:



Kind regards

S
profile picture

Eugene

#2
Hi,
There's a Position.EntryPrice property that lets you refer to the entry price directly. Check out the QuickRef (F11 key or F1 in the Editor) for its description and sample usage.

If you wish to keep an arbitary value then you can save it into a variable of applicable type (double, integer etc.) Here's how to refer to the crossover bar, for example:
CODE:
Please log in to see this code.


Taking the built-in "Moving Average Crossover" for example, here's how it might look like:

CODE:
Please log in to see this code.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).