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?
Size:
Color:
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.
Size:
Color:
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.
Size:
Color:
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.
Size:
Color:
thank you
Size:
Color:
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
Size:
Color:
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.
Size:
Color:
top thank you
Size:
Color: