読み取り専用

フォーラムは現在、読み取り専用のアーカイブとなっています。.

バグ報告やプラットフォームに関する質問はこちら → [email protected]

私たちのコミュニティはDiscordとYouTubeで活動しています。ぜひ参加してください!

ご参加ください Discord YouTube

How to make a condition delay for a period time in a strategy

2件の返信

Hans Hwang

登録者、bbp_participant、2件の返信。.

プロフィールを表示

6年前 #259239

Hello I found AlgoWizard today and very exciting that this is really a good tool.

I have read the help document and tried some EA.

I want to make an EA with one or 2 conditions delay, which means when these condition trigered, the condition will be set to be True for a period time, no mater the original condition has turn into false。

here is an simple example:

When MACD divergency in the past 60 bars, when MACD cross 0 line open buy. ( it shows divergency in the past but maybe not in recent. )

I saw that we can use if…then to set variables, maybe I can set a variable when MACD divergency and let it last for 60 bars ?

And MACD divergency is another feature, which I have saw a sample in the user document, havn’t view it yet.

Any responce will be thanksful, I will go on try this and will give some further info.

ありがとう

 

0

Tomas Matejka

管理者、sq-ultimate、2件の返信.

プロフィールを表示

6年前 #259278

こんにちは、,

if you want to combine two signals that do not have to appear at the same time but with a delay from one another you can easily achieve that by using variables (call them state variables) so you will split the logic into 2 steps:

1) check for MACD divergency … when a buy MACD divergency occurs you set a variable (create a new one called ‘divergencyState (int)) to +1

2) create a second condition that checks a situation when MACD crosses above 0 AND divergencyState = 1 …. now you can trigger a buy entry and set divergencyState back to 0 for next situation

This way there can be multiple bars delay between those two signals so after a divergence a strategy “waits” until the MACD crosses above 0 line

If you want to limit the number of bars between signals you also need to “count bars” after divergencyState is set to 1 and check for “max bars to detect MACD cross above 0”

Let me know if you need any help with this

0

Hans Hwang

登録者、bbp_participant、2件の返信。.

プロフィールを表示

6年前 #259306

ご回答ありがとうございます。.

I have question about “count bars”, how can I do this ?

And about the macd divergency, I found that the example can’t click, which is https://algowizard.io/examples/

how can I check divergency?

ありがとう

0

2件の返信を表示中 - 1 - 2件目 (全2件中)