Entry and Exit price equal to indicator value

Questions directed to our Support Team. Responses can be expected within 24 hours.

Entry and Exit price equal to indicator value

Postby mandelmus » Wed Sep 02, 2015 3:42 am

Is there a way to set the entry and exit price equal to an indicator value if the price crosses that indicator?

For example:
[*] enter long when/if the price crosses above yesterday's ma50 value and set the entry price as the value of yesterday's ma50
[*] exit the long when/if the price crosses below yesterday's ma50 value and set the exit price as the value of yesterday's ma50

If so, how would I configure this on the "General" and "Order Types" tabs?
mandelmus
 
Posts: 141
Joined: Fri Dec 23, 2011 1:51 pm

Re: Entry and Exit price equal to indicator value

Postby Overload » Wed Sep 02, 2015 10:20 am

Yes, you can change the Entry Price and Exit Price on the Order Types tab to any value of your choice. So instead of:

ref(open, 1)

You would change it to:

ref(mov(close, 50, simple), -1)

Keep in mind that the point of reference for the Order Prices is the Signal Date, not the Trade Date. The Trade Date is one day after the Signal Date, and that's why the entry price is usually: ref(open, 1). And that's also why I needed to use ref(..., -1) to reference "yesterday's" moving average. That means 1 day before the Signal Date, and 2 days before the Trade Date. That may sound confusing, but it's important to understand if you want to use the correct day's prices for your entry and exit.

Your Entry String and Exit String work just as they normally would. You can trigger the buy/sell with the crossover as usual.

The main caveat to be aware of is that this only revises the buy and sell prices, but the daily valuations are still based on the close price of the symbol each day. So your position drawdowns etc will not be based on the moving average prices, but the symbol's close prices. There isn't a way to have the daily valuations of open positions be based on anything other than the close price of the symbol.

Hopefully this helps.

Pete
Overload
 
Posts: 2248
Joined: Wed Nov 30, 2005 12:14 pm


Return to Technical Support