Implement trend signals

This commit is contained in:
2022-12-06 19:46:06 +00:00
parent 242c9fbaed
commit 3b3faecdf1
5 changed files with 87 additions and 3 deletions

View File

@@ -122,6 +122,7 @@ class StrategyForm(RestrictedFormMixin, ModelForm):
"time_in_force",
"entry_signals",
"exit_signals",
"trend_signals",
"enabled",
"take_profit_percent",
"stop_loss_percent",
@@ -138,8 +139,9 @@ class StrategyForm(RestrictedFormMixin, ModelForm):
"trading_times": "When the strategy will place new trades.",
"order_type": "Market: Buy/Sell at the current market price. Limit: Buy/Sell at a specified price. Limits protect you more against market slippage.",
"time_in_force": "The time in force controls how the order is executed.",
"entry_signals": "The entry signals to attach to this strategy. Callbacks received to these signals will trigger a trade.",
"exit_signals": "The exit signals to attach to this strategy. Callbacks received to these signals will close all trades for the symbol on the account.",
"entry_signals": "Callbacks received to these signals will trigger a trade.",
"exit_signals": "Callbacks received to these signals will close all trades for the symbol on the account.",
"trend_signals": "Callbacks received to these signals will limit the trading direction of the given symbol to the callback direction until further notice.",
"enabled": "Whether the strategy is enabled.",
"take_profit_percent": "The take profit will be set at this percentage above/below the entry price.",
"stop_loss_percent": "The stop loss will be set at this percentage above/below the entry price.",
@@ -161,6 +163,12 @@ class StrategyForm(RestrictedFormMixin, ModelForm):
help_text=Meta.help_texts["exit_signals"],
required=False,
)
trend_signals = forms.ModelMultipleChoiceField(
queryset=Signal.objects.all(),
widget=forms.CheckboxSelectMultiple,
help_text=Meta.help_texts["trend_signals"],
required=False,
)
trading_times = forms.ModelMultipleChoiceField(
queryset=TradingTime.objects.all(), widget=forms.CheckboxSelectMultiple
)