Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Unfortunately, this didn't work. I will post some more details tomorrow to see if we can get this figured out. It may be something that plenty of people will find beneficial.
Can you help answer these questions from other members on NexusFi?
Okay. I just posted the idea from the top of my head and didn't test it first.
If you post the whole code, I can take a look at it tomorrow as well.
Regards and a good night,
ABCTG
JGSmith
Unfortunately, this didn't work. I will post some more details tomorrow to see if we can get this figured out. It may be something that plenty of people will find beneficial.
In EasyLanguage, first occurrences of a condition being true or false can be derived by comparing the value of a variable set when the current bar is evaluated vs the value of the same variable set when the previous bar was evaluated.
For instance, if you store your condition (true/false) result in a variable "HavePaintBar" in your code - something like this:
if (myCondition) then
HavePaintBar = True
Else
HavePaintBar = False;
Then to check if the condition became true for the first time, you could write something like this:
If (HavePaintBar = True And HavePaintBar[1] = False) then
PlotPaintBar()...
The value evaluated for a variable for each previous bar can be accessed by using the [1], [2]... etc suffix as if the values are being stored in an array and you can access the value using the array index.
Okay. I just posted the idea from the top of my head and didn't test it first.
If you post the whole code, I can take a look at it tomorrow as well.
Regards and a good night,
ABCTG
Great, thanks so much. Your help has been invaluable toward my further understanding.
iNeo
In EasyLanguage, first occurrences of a condition being true or false can be derived by comparing the value of a variable set when the current bar is evaluated vs the value of the same variable set when the previous bar was evaluated.
For instance, if you store your condition (true/false) result in a variable "HavePaintBar" in your code - something like this:
Thank you iNeo. This has helped to move things forward. From what I can see, it is better - but still not exact.
I am posting a pic and the code for what I have so far.
Important for anybody reading this and may say, "Wow, that code produced a really great buy signal!!" and then attempt to use it. There is still one very important parameter that is not entered into the code yet so it is not tradeable as it is. Secondly, I haven't seen this strategy work as well on Futures or Equities. It may work, but I have not been able to find other instruments besides certain FX pairs that it works on.
In the picture, you will see some Blue squares. These blue squares are the ones that are correct - according to the current parameters. Those with the Red arrow above them are incorrect.
input:
thold ( 20 ) ,
length ( 14 ) ,
CandleColorLong( white ) ,
CandleColorShort( Magenta ),
AroonLength( 14 ),
KCATR( 1.5 ) ,
KCLength( 20 ),
MALength( 20 ),
AFStep( 0.02 ),
AfLimit( 0.2 );
variables:
var0( 0 ) ,
var1( 0 ) ,
var2( 0 ) ,
var3( 0 ) ,
HavePaintBar( false ) ;
Value1 = ParabolicSAR( AfStep , AfLimit , var0 , var1 , var2 , var3 ) ;
if __AroonUp( AroonLength ) = 100 and
Close > Open and
Close > KeltnerChannel(close , KCLength , KCATR ) and
Close > Average( Close , MALength ) and
var3 <= 1 and
(__AroonUp[1]( AroonLength ) <> 100 or
Close[1] < Open[1] or
Close[1] < KeltnerChannel(close , KCLength , KCATR )[1] or
Close[1] < Average( Close , MALength )[1] or
var3 <= 1 )
then
HavePaintBar = True
else
HavePaintBar = False;
If HavePaintBar = True and
HavePaintBar[1] = False then
PlotPaintBar(High , Low , Open , Close , "" , CandleColorLong ) ;
First, is there someway that I have misunderstood what has been said already and that is causing me to not get the result that I am looking for?
Secondly, if I have understood everything correctly thus far, can you see the adjustments that I need to make?
I genuinely want to thank people for their help. This has been invaluable to my learning up this point.
Please check this code, I am using the close below the Keltner to reset the ability to look for a new paintbar.
If this doesn't do what you want, maybe you can post a screenshot that displays the bars this study shouldn't mark (just like you did with your study).
Regards,
ABCTG
input:
thold ( 20 ) ,
length ( 14 ) ,
CandleColorLong( white ) ,
CandleColorShort( Magenta ),
AroonLength( 14 ),
KCATR( 1.5 ) ,
KCLength( 20 ),
MALength( 20 ),
AFStep( 0.02 ),
AfLimit( 0.2 );
variables:
var0( 0 ) ,
var1( 0 ) ,
var2( 0 ) ,
var3( 0 ) ,
KeltnerValue(0),
HavePaintBar( false ) ;
Value1 = ParabolicSAR( AfStep , AfLimit , var0 , var1 , var2 , var3 ) ;
KeltnerValue = KeltnerChannel(close , KCLength , KCATR );
//the reset part:
if Close < KeltnerValue and HavePaintBar then
HavePaintBar = false;
if __AroonUp( AroonLength ) = 100 and
Close > Open and
Close > KeltnerValue and
Close > Average( Close , MALength ) and
var3 <= 1 and
(__AroonUp( AroonLength ) <> 100 or
Close[1] < Open[1] or
Close[1] < KeltnerValue[1] or
Close[1] < Average( Close , MALength )[1] or
var3 <= 1 )
then
HavePaintBar = True;
If HavePaintBar = True and
HavePaintBar[1] = False then
PlotPaintBar(High , Low , Open , Close , "" , CandleColorLong ) ;
Please check this code, I am using the close below the Keltner to reset the ability to look for a new paintbar.
If this doesn't do what you want, maybe you can post a screenshot that displays the bars this study shouldn't mark (just like you did with your study).
That works like a charm!
So it looks like you added another variable: KeltnerValue.
So basically if I wanted to do this with another indicator then I would need to add a new variable and then assign that variable with a value then I do that fancy little if/then statement and it all works?
Great. It didn't not work before, because in a previous post I just wrote "KeltnerChannel" without the inputs.
That's why it probably didn't compile on your end.
I just added the KeltnerValue variable so you don't have to call the same function three times in your code. Now it's only called one time and the value is assigned to the variable KeltnerValue.
You could do the same with the __AroonUp and the Average, as you call them twice, too.
With your study this isn't a problem, but every function call will add to the time the indicator takes for the calculations.
Your study will also become easier to maintain when all functions are called in one place and then stored within variables for further use (at least this is my experience).
Yes, it should work the same when you want to do it with another indicator.
Regards,
ABCTG
JGSmith
That works like a charm!
So it looks like you added another variable: KeltnerValue.
So basically if I wanted to do this with another indicator then I would need to add a new variable and then assign that variable with a value then I do that fancy little if/then statement and it all works?
I just wanted to come on here and post a picture of the completed first phase of my very first indicator that I have written (with the exception of practice indicators while trying to learn)
This is the basis for a strategy that I trade very regularly and now I can just remove the indicators from my chart and have a nice clean and pretty screen.
After patting myself on the back for a little bit and reveling in this accomplishment - there will be plenty of more work to get the next phases completed.
Here is a picture of the work. (The arrows are not part of the indicator - they are just to make more obvious where the PaintBars are for the sake of this screenshot.)
Looks good, congratulations. As you are using Multicharts you can in fact let the indicator draw the arrows on the chart, too.
Arw_New, Arw_New_s or Arw_New_DT are the three reserved words that can draw a new arrow. You can change size, color and style with keywords words, too.
Regards,
ABCTG
JGSmith
I just wanted to come on here and post a picture of the completed first phase of my very first indicator that I have written (with the exception of practice indicators while trying to learn)
This is the basis for a strategy that I trade very regularly and now I can just remove the indicators from my chart and have a nice clean and pretty screen.
After patting myself on the back for a little bit and reveling in this accomplishment - there will be plenty of more work to get the next phases completed.
Here is a picture of the work. (The arrows are not part of the indicator - they are just to make more obvious where the PaintBars are for the sake of this screenshot.)