Norgate Data & stock leaving the index (SOLVED)
Author: tobiastempus
Creation Date: 11/6/2020 9:55 AM
profile picture

tobiastempus

#1
Hello,

i have a problem with a bollinger band system and norgate current and past data.

1.sometimes i get a wrong buy signal with my system for a stock that is leaving the index because there is always a upgap after leaving the index?



2.if i get a regular buy signal and the stock is leaving the index later ,the system is still in that trade.
do you know how i can solve that problem?

profile picture

Cone

#2
A gap usually isn't indicative of the day a stock leaves an index. It's more likely to be a corp. action announcement that is later followed by an index change. Anyway, in both cases, the strategy should have rules to exit a position when it leaves the index and/or before the series ends.

You can check if the series ends just by looking at the date of the last bar, or even more easily by checking of the symbol contains a hyphen "-". That way, you can be sure to make sure to exit all positions on the last bar.

You also probably want to avoid entering a position that is triggered on the day before the symbol leaves an index. That's another rule.

Here's the 3 x 2 strategy with those ideas implemented. Notice that the "end of series" check to exit open positions is done conveniently in the last block of code, after the trading loop.

CODE:
Please log in to see this code.
profile picture

tobiastempus

#3
thank much for your answer.


i am very bad with the editor but i tried to adjust my code with your code but i dont get any trades.Maybe you have an idea of the mistake?


CODE:
Please log in to see this code.
profile picture

Cone

#4
First thing I notice is that "Nasdaq 100" does not work. It needs to be UPPERCASE, or you can also use the Norgate Index symbol $NDX. (You should do that anyway instead of relying on the Yahoo! ^NDX symbol.

The code errors were:
1. Missing brackets that modify the exit logic, and,
2. The exit logic was looking for SignalName "Group 1|" from the Strategy Builder. This could be solved by adding it as the entry SignalName, but it's not required, so I deleted it from the exit logic.

When I get a chance, I'll work on adding the rules required for Norgate to the Strategy Builder.

CODE:
Please log in to see this code.
profile picture

tobiastempus

#5
thank you
profile picture

tobiastempus

#6
sorry but i have one last problem my benchmark is stopping at 2019 and i have no idea why .its the sam with $NDX and ^NDX


*fixed it
profile picture

Cone

#7
I was having trouble getting started on something else today, so I knocked this out while fresh in my mind. Grab the latest version of the Community.Rules to get the set of "Norgate Historical" conditions for Historical Backtesting with Norgate Data.

profile picture

tobiastempus

#8
top thank you
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).