変数をブール値に設定し、再び変更されるまで保持する
6件の返信
I’m using a commercial indicator that lacks support for alarms, therefore I reprogrammed it. It’s actually pretty simple: A moving average with 3 levels of ATR are plotted above and below (see screenshot). I want to get a signal when Ask is above or equal to MA + 3times ATR or Bid is below MA – 3times ATR. However, to not getting a signal on every tick when conditions are met, I want to set a boolean variable to false after the first detection of the signal and only allowing the signal again, after one bar has closed within the “borders”, the Boolean variable is reset to “true”.
For backtesting purposes, I went for +/- 1times ATR to get more signals. Right in the middle of the screenshot, you can easily spot an area, where short signals (red) are plotted that shouldn’t be allowed by the “reset” function (green) that resets the bool var to true. Why is this?
If anyone is kind enough to check on this, I attached the sqw file, too.
One more question: Is there any way to have values of variables plotted right on the chart for debugging purposes?
0
こんにちは,
sure, I will check the project and let you know
0
こんにちは,
did you export the project to an Expert Advisor or a Signal Indicator?
0
I exported to a Signal Indicator.
0
I still can’t find my mistake.
0
こんにちは,
you can try to export it as an expert advisor and see how it works then for you. It still can only draw arrow up or down with no trading. There seems to be with a difference in code evaluation when exported as the signal indicator
0
Thank you! I will fix it by hand.
0
6件の返信を表示中 - 1 - 6件目 (全6件中)