OPEN-SOURCE SCRIPT

AMRS_LongOnly_PartTimer

This Script is created to back-test the data starting 01/01/2000 based on AMRS strategy.

AMRS is long only strategy. It is based on unique calculation around moving averages and 2 year high price.

There are few strategies for moving average crossovers but AMRS strategy is unique compared to other moving averages strategies as it has very specific below mentioned calculations evolving around moving average and stock price.

AMRS strategy is unique one to generate buying signals when stock price creates new 2 year high and retraces back to 13 day EMA value.
AMRS strategy is unique one having specific calculation for entry signal and exit signal as mentioned below. This strategy gives back testing results to help build conviction on entry/exits if trades were taken in past as per the AMRS rules.

As per AMRS strategy this script generates green arrow on each time when new 2 year high is made and also generates long signal indicated by white arrow when stock price retraces back to 13 day EMA value and price is within 10% range from 2 year high.
This strategy will generate white arrow on the chart for each buy signal when stock price reaches 13 day EMA after first Long signal is generated. These subsequent buy signals can be used for pyramiding.

Entry Signal Logic : 1. Stock should be trading near 2 year high.
2. Stock price should be within 10% range from 2 year high
3. Stock price should be less than or equal to 13 day EMA and grater than equal to 21 day EMA

This AMRS strategy also generates exit signal for already generated buy signal (open position).

Exit signal generated when stock price closes 5% below 21 day EMA or when stock price closes below 20% from most recent 2 year high price.

Exit Signal Logic : 1. Stock price closes 5% below 21 day EMA or stock price closes below 20% from most recent 2 year high price.
2. Since exit logic is based on closing price it is plotted on the chart next day.
3. So when exit signal is plotted on the chart, previous days stock price is either closed below 5% of 21 day EMA or corrected 20% from recent 2 year high.

Note : To Calculate last entry positions % return, by default all positions are getting closed on mentioned end date.

Script parameters :

start date as 01/01/2000 - Constructed from Start Year - 2000, Start Month - 1 Start Date - 1
End date (mostly current date) Constructed from Values in End Year, End Month, End Date.
Initial Capital - Defaulted to 100000
Order Size - 5% of Equity
Pyramiding - 3 orders
Commission - 0.2%
Slippage - 1 tick (Since this strategy exit is on close basis mostly there wont be any slippages)
Exponential Moving Average (EMA)

Skrypt open-source

W prawdziwym duchu TradingView autor tego skryptu opublikował go jako open source, aby inwestorzy mogli go zrozumieć i zweryfikować. Pozdrowienia dla autora! Możesz go używać bezpłatnie, ale ponowne użycie tego kodu w publikacji podlega Zasadom Regulaminu. Możesz go oznaczyć jako ulubione, aby użyć go na wykresie.

Chcesz użyć tego skryptu na wykresie?

Wyłączenie odpowiedzialności