How to program/adjust an indicator?
Author: stefanpad
Creation Date: 3/16/2016 5:25 PM
profile picture

stefanpad

#1
Thank you Eugene!

May ask two basic questions regarding my first steps on backtesting:

1. Where to find & explained easiest how to program an indicator myself, or to be more precise, adjust a given indicator, let's say s simple SMA? Could you guide me to an example?

2. Execution logic:
If selected "Buy at market -> Price crosses above Moving Average".

Should the displayed entry price equal the price, at which the price crosses the moving average? If I am correct it instead uses the price of the next bar's open. What am I missing?

Thank you for your help.

Regards,
Stefan
profile picture

Eugene

#2
1. Programming an indicator "on-the-fly" is exemplified in the WealthScript Programming Guide > Indicators.

Adjusting a "formal" indicator like SMA is a topic for advanced users (C# developers): see Create an Indicator Library.

2. No, it shouldn't. A complete bar updates and your strategy is executed over all the bars in the chart and determines if an alert is to be fired on the next bar. If you wish to get into the trade on the close, choose Buy At Close instead but note that you lose Alerts (not supported for AtClose orders).
profile picture

stefanpad

#3
Thank you very much. Very helpful.

Re 2.: If I understand you correctly there are options to either a) execute at open of next bar and b) close of current bar.

Is there also an option to execute straight at the signal, meaning as it happens during a day, in case daily bars are used?

profile picture

Eugene

#4
The thing is, within the incomplete bar the signal may fire, then become desactivated, then fire again, changing with the data. Here's how the process works in Wealth-Lab:

FAQ > Is it necessary to have access to intra-bar tick data to daytrade with Wealth-Lab?

P.S. It's possible to update an EOD indicator using intraday values but that's only for advanced users (requires programming):

Updating a Daily indicator using Intraday values
profile picture

Eugene

#5
QUOTE:
Is there also an option to execute straight at the signal, meaning as it happens during a day, in case daily bars are used?

There is: AtStop/AtLimit orders.
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).