Ducks In A Row
- gaheitman
- Trader
- Posts: 655
- Joined: Tue Nov 15, 2011 10:55 pm
- Location: Richmond, VA, US
Re: Ducks In A Row
Doc,
In order to code this baby, we have to use numerical tests for each of your ducks. Our EAs will do the following:
A new bar opens on the chart. Time to start evaluating everything and see if we have a trade. Let's look at all the ducks.
1st Duck - EMA cross signalled.
Checking a cross is pretty easy. We look at the values of the EMA 3 and the EMA 8 and if they EMA3 is now below EMA8 and last bar it was above it, we know we have a cross. A cross down to be exact, so we are looking for sells.
2nd Duck - the PA is trending in the same direction as the 50
Hmmm. Not sure how we test this. Do we just make sure the last bar closed above/below the EMA 50? Or does it have to be the last three bars? Do they need to all be bullish/bearish? Remember, we can look at the numbers associated with the EMA lines for each bar back as well as the Open/High/Low/Close values of all the candles.
3rd Duck - the RSI is breaking above/below the 45/55.
For a sell, does that mean on the previous bar it was above 45 and now it is below at the open of this bar? (Opposite with a buy and using 55.)
4th Duck - the RSI angle is between 12 and 2 o'clock or 4 and 6 o'clock..
For the angle, all we can do is determine the rate of change of the last x bars. So if the RSI needs to drop 6 points or 16 points or 60 points, we can check that. We just need to know which it is and how many bars to look at. If it is more than 1 bar back, do we take the biggest movement over those bars?
5th Duck - Lawgirl's indi showing the same trend on the long side of the M5, H1 & D1.
I believe this is another RSI reading. We can check and make sure the RSI values for those time frames are above/below whatever threshold she has in the indicator to point up/down.
6th Duck - CJA SignalBars indi - same, same
Don't know about the internals of this one, but we can just read the values and see if they equate to the pictures you are looking at.
When I've gotten all my 'Ducks In A Row' I enter on the first candle to open above/below the 3/50EMA - supported by the RSI being clear of the 45/55 RSI.
If all of the above come out as sell (or buy) we then look for a candle to open below (or above) the 3 EMA (since I am assuming that price is already on the right side of the 50 EMA based on my interpretation of the second duck and RSI is clear based on the third duck)
If we didn't enter on this bar, do we re-evaluate everything on the next bar, or just keep looking for an entry until price goes to the other side of the 50 EMA. Said another way, how long is the trigger valid?
One thing that might help you when answering these questions is to open up the data window on your chart and see all the values as you move your mouse from bar to bar. That is the stuff we can "see" in our code, and that is what we have to use to make decisions.
George
In order to code this baby, we have to use numerical tests for each of your ducks. Our EAs will do the following:
A new bar opens on the chart. Time to start evaluating everything and see if we have a trade. Let's look at all the ducks.
1st Duck - EMA cross signalled.
Checking a cross is pretty easy. We look at the values of the EMA 3 and the EMA 8 and if they EMA3 is now below EMA8 and last bar it was above it, we know we have a cross. A cross down to be exact, so we are looking for sells.
2nd Duck - the PA is trending in the same direction as the 50
Hmmm. Not sure how we test this. Do we just make sure the last bar closed above/below the EMA 50? Or does it have to be the last three bars? Do they need to all be bullish/bearish? Remember, we can look at the numbers associated with the EMA lines for each bar back as well as the Open/High/Low/Close values of all the candles.
3rd Duck - the RSI is breaking above/below the 45/55.
For a sell, does that mean on the previous bar it was above 45 and now it is below at the open of this bar? (Opposite with a buy and using 55.)
4th Duck - the RSI angle is between 12 and 2 o'clock or 4 and 6 o'clock..
For the angle, all we can do is determine the rate of change of the last x bars. So if the RSI needs to drop 6 points or 16 points or 60 points, we can check that. We just need to know which it is and how many bars to look at. If it is more than 1 bar back, do we take the biggest movement over those bars?
5th Duck - Lawgirl's indi showing the same trend on the long side of the M5, H1 & D1.
I believe this is another RSI reading. We can check and make sure the RSI values for those time frames are above/below whatever threshold she has in the indicator to point up/down.
6th Duck - CJA SignalBars indi - same, same
Don't know about the internals of this one, but we can just read the values and see if they equate to the pictures you are looking at.
When I've gotten all my 'Ducks In A Row' I enter on the first candle to open above/below the 3/50EMA - supported by the RSI being clear of the 45/55 RSI.
If all of the above come out as sell (or buy) we then look for a candle to open below (or above) the 3 EMA (since I am assuming that price is already on the right side of the 50 EMA based on my interpretation of the second duck and RSI is clear based on the third duck)
If we didn't enter on this bar, do we re-evaluate everything on the next bar, or just keep looking for an entry until price goes to the other side of the 50 EMA. Said another way, how long is the trigger valid?
One thing that might help you when answering these questions is to open up the data window on your chart and see all the values as you move your mouse from bar to bar. That is the stuff we can "see" in our code, and that is what we have to use to make decisions.
George
- gaheitman
- Trader
- Posts: 655
- Joined: Tue Nov 15, 2011 10:55 pm
- Location: Richmond, VA, US
Ducks Indicator
I'm sure everyone is used to me saying "in order to visualise...." so I won't say it this time....
Attached is the Ducks indicator. Since we are only allowed 8 indicator buffers, I have written the indicator to show only one duck at a time. This should also make it easier to evaluate the correctness of the particular duck. If you want to see more ducks, you just drop another copy on the chart and choose which duck you'd like to see.
I have coded "something" for ducks 1-5, but much of it is just guesses. I'll try to add duck 6 over the weekend.
The settings:
The picture:
Duck 5 is only valid on 5 minute, hourly and daily charts, since I hard-coded the second timeframe for the lawgirl indy.
This is by no means an industrial strength indicator, just a tool to help us track down how to code the indicator. There are likely many bugs in it as well, since I'm kind of rushing in hopes of getting it out in time to make some progress this weekend.
WARNING: I'll talk about this in more detail in another post, but the indicator uses the current bar RSI since that's all you can normally have on a chart. Keep in mind that this RSI is calculated on the close of the bar, so it seems terribly accurate when looking at historical data. Don't be fooled!
George
Attached is the Ducks indicator. Since we are only allowed 8 indicator buffers, I have written the indicator to show only one duck at a time. This should also make it easier to evaluate the correctness of the particular duck. If you want to see more ducks, you just drop another copy on the chart and choose which duck you'd like to see.
I have coded "something" for ducks 1-5, but much of it is just guesses. I'll try to add duck 6 over the weekend.
The settings:
Code: Select all
//which duck to display
extern int Duck=1;
//duck 1
extern int FastMA=3;
extern int SlowMA=8;
extern int MA_Mode=MODE_EMA;
//duck 2
extern int TrendMA=50;
extern int TrendMAMode=MODE_EMA;
//duck 3
extern int RSI=8;
//duck 4
extern int RSI_Bars_For_Angle=1;
extern int RSI_Points_For_Angle=10;
//duck 5
//using Lawgirls defaults
Duck 5 is only valid on 5 minute, hourly and daily charts, since I hard-coded the second timeframe for the lawgirl indy.
This is by no means an industrial strength indicator, just a tool to help us track down how to code the indicator. There are likely many bugs in it as well, since I'm kind of rushing in hopes of getting it out in time to make some progress this weekend.
WARNING: I'll talk about this in more detail in another post, but the indicator uses the current bar RSI since that's all you can normally have on a chart. Keep in mind that this RSI is calculated on the close of the bar, so it seems terribly accurate when looking at historical data. Don't be fooled!
George
You do not have the required permissions to view the files attached to this post.
- Aussiedoc
- Trader
- Posts: 270
- Joined: Tue Dec 13, 2011 8:10 am
- Location: Western District. Victoria. Australia
Re: Ducks In A Row
Sorry boys! It's been rough 1st week of the annual Christmas/January holidays. I've been coping with rampant egos in damaged unfit bodies who can't/won't accept that, good and all as I am, I don't have a magic wand that will fix them -- YESTERDAY!SteveHopwood wrote:Not a hint of it, and dragging information from you is like pulling teeth.Aussiedoc wrote:Because the 3 & the 8 are pretty fast MAs I'm looking for the cross to happen within 3-5 candles of the pivot.
Hope this all makes sense!
Which pivot? How do you measure it? Recognise it? Make it up as you go along? Anything, really.
Please accept my humble apologies!!!
Getting down to basics... The Pivot rules I was taught are:-
1. a pivot is an indication of a change in trend direction - determined by 5 candles. (1-2-3 candles trending in one direction followed by the 4th, 5th & subsequent candles in the opposite direction.)
2. the 3rd candle is the pivot (swing-high/low).
3. a pivot is not fully formed until either the 4th or 5th candle opens above/closes below the body of the pivot candle.
Is this what you need??
Cheers.
If you can never exceed your own expectations - why expect second-best?
- Aussiedoc
- Trader
- Posts: 270
- Joined: Tue Dec 13, 2011 8:10 am
- Location: Western District. Victoria. Australia
Re: Ducks In A Row
George, in between patients; I've been having a quick read through your post. Re the above...One thing that might help you when answering these questions is to open up the data window on your chart and see all the values as you move your mouse from bar to bar. That is the stuff we can "see" in our code, and that is what we have to use to make decisions.
George
I'm a bit 'snowed under' at the moment. (It's 1400 Saturday; 35+ degrees. we've got wall-to-wall 'grumpy' damaged people (benefits of a small rural farming/holiday community) wanting 'immediate' attention; I've got a 4HR round trip, shifting a 91YO invalid a couple of 100KMs to more extensive facilities, coming up in the next few minutes - and then, when I get back... It's my turn to cope with all the overnight fun and games until around 0700 Sunday AM.) I should re-surface around 1500 Sunday (GMT +11).
Is it OK if I do my best to specifically answer each point then??
Cheers
If you can never exceed your own expectations - why expect second-best?
- gaheitman
- Trader
- Posts: 655
- Joined: Tue Nov 15, 2011 10:55 pm
- Location: Richmond, VA, US
Re: Ducks In A Row
Absolutely. Good luck with your patients.Aussiedoc wrote:George, in between patients; I've been having a quick read through your post. Re the above...One thing that might help you when answering these questions is to open up the data window on your chart and see all the values as you move your mouse from bar to bar. That is the stuff we can "see" in our code, and that is what we have to use to make decisions.
GeorgeI ddeall! I understand. WOW!!!
![]()
Until now; I never knew such a thing was possible!
I'm a bit 'snowed under' at the moment. (It's 1400 Saturday; 35+ degrees. we've got wall-to-wall 'grumpy' damaged people (benefits of a small rural farming/holiday community) wanting 'immediate' attention; I've got a 4HR round trip, shifting a 91YO invalid a couple of 100KMs to more extensive facilities, coming up in the next few minutes - and then, when I get back... It's my turn to cope with all the overnight fun and games until around 0700 Sunday AM.) I should re-surface around 1500 Sunday (GMT +11).
Is it OK if I do my best to specifically answer each point then??
Cheers
George
- SteveHopwood
- Owner
- Posts: 9904
- Joined: Tue Nov 15, 2011 8:43 am
- Location: Misterton - an insignificant village in England. Very pleasant to live in.
Re: Ducks In A Row
Yes, thanks.Aussiedoc wrote:3. a pivot is not fully formed until either the 4th or 5th candle opens above/closes below the body of the pivot candle.
Is this what you need??
Cheers.
These are obvious when you look at them on the chart. Did you know that the Fractals indi draws them as well? I can use F to help the EA detect the pivots and they make a good visual confirmation.
Read the effing manual, ok?
Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.
I still suffer from OCCD. Good thing, really.
Anyone here feeling generous? My paypal account is always in the market for a tiny donation. pianodoodler@hotmail.com is the account.
To see The Weekly Roundup of stuff you guys might have missed Click here
My special thanks to Thomas (tomele) for all the incredible work he does here.
Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.
I still suffer from OCCD. Good thing, really.
Anyone here feeling generous? My paypal account is always in the market for a tiny donation. pianodoodler@hotmail.com is the account.
To see The Weekly Roundup of stuff you guys might have missed Click here
My special thanks to Thomas (tomele) for all the incredible work he does here.
- SteveHopwood
- Owner
- Posts: 9904
- Joined: Tue Nov 15, 2011 8:43 am
- Location: Misterton - an insignificant village in England. Very pleasant to live in.
Re: Ducks Indicator
Fantastic George. I will stop development of the EA whilst you work on this. Once it is up and running, we can replace the existing trade-decision functionality with a single call to your indi.gaheitman wrote:I'm sure everyone is used to me saying "in order to visualise...." so I won't say it this time....![]()
Attached is the Ducks indicator. Since we are only allowed 8 indicator buffers, I have written the indicator to show only one duck at a time. This should also make it easier to evaluate the correctness of the particular duck. If you want to see more ducks, you just drop another copy on the chart and choose which duck you'd like to see.
I have coded "something" for ducks 1-5, but much of it is just guesses. I'll try to add duck 6 over the weekend.
The settings:
The picture:Code: Select all
//which duck to display extern int Duck=1; //duck 1 extern int FastMA=3; extern int SlowMA=8; extern int MA_Mode=MODE_EMA; //duck 2 extern int TrendMA=50; extern int TrendMAMode=MODE_EMA; //duck 3 extern int RSI=8; //duck 4 extern int RSI_Bars_For_Angle=1; extern int RSI_Points_For_Angle=10; //duck 5 //using Lawgirls defaults
Duck 5 is only valid on 5 minute, hourly and daily charts, since I hard-coded the second timeframe for the lawgirl indy.
This is by no means an industrial strength indicator, just a tool to help us track down how to code the indicator. There are likely many bugs in it as well, since I'm kind of rushing in hopes of getting it out in time to make some progress this weekend.
WARNING: I'll talk about this in more detail in another post, but the indicator uses the current bar RSI since that's all you can normally have on a chart. Keep in mind that this RSI is calculated on the close of the bar, so it seems terribly accurate when looking at historical data. Don't be fooled!
George
Just a note: Doc uses a smothed ma, not an ema.
Read the effing manual, ok?
Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.
I still suffer from OCCD. Good thing, really.
Anyone here feeling generous? My paypal account is always in the market for a tiny donation. pianodoodler@hotmail.com is the account.
To see The Weekly Roundup of stuff you guys might have missed Click here
My special thanks to Thomas (tomele) for all the incredible work he does here.
Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.
I still suffer from OCCD. Good thing, really.
Anyone here feeling generous? My paypal account is always in the market for a tiny donation. pianodoodler@hotmail.com is the account.
To see The Weekly Roundup of stuff you guys might have missed Click here
My special thanks to Thomas (tomele) for all the incredible work he does here.
- gaheitman
- Trader
- Posts: 655
- Joined: Tue Nov 15, 2011 10:55 pm
- Location: Richmond, VA, US
Re: Ducks Indicator
Hmmm, the templates have EMAs in them. From the D1 template:SteveHopwood wrote: Just a note: Doc uses a smoothed ma, not an ema.
<indicator>
name=Moving Average
period=50
shift=0
method=1
apply=0
color=16711935
style=0
weight=2
period_flags=0
show_data=1
</indicator>
<indicator>
name=Moving Average
period=8
shift=0
method=1
apply=0
color=255
style=0
weight=2
period_flags=0
show_data=1
</indicator>
<indicator>
name=Moving Average
period=3
shift=0
method=1
apply=0
color=65280
style=0
weight=2
period_flags=0
show_data=1
</indicator>
- SteveHopwood
- Owner
- Posts: 9904
- Joined: Tue Nov 15, 2011 8:43 am
- Location: Misterton - an insignificant village in England. Very pleasant to live in.
Re: Ducks Indicator
It sure does, and that caused me some grief trying to work out why the EMA Crossover indi signals were wrong. In the indi, the ma's are hard-coded as smoothed ma's.gaheitman wrote:Hmmm, the templates have EMAs in them. From the D1 template:SteveHopwood wrote: Just a note: Doc uses a smoothed ma, not an ema.
<indicator>
name=Moving Average
period=50
shift=0
method=1
apply=0
color=16711935
style=0
weight=2
period_flags=0
show_data=1
</indicator>
<indicator>
name=Moving Average
period=8
shift=0
method=1
apply=0
color=255
style=0
weight=2
period_flags=0
show_data=1
</indicator>
<indicator>
name=Moving Average
period=3
shift=0
method=1
apply=0
color=65280
style=0
weight=2
period_flags=0
show_data=1
</indicator>
I thought your indi was fabulous when I looked at your post. I am blown away now I have set it up on a chart.
Time then to open a dedicated automation development thread so that everything can go into one place. This is open at http://www.stevehopwoodforex.com/phpBB3 ... 5129#p5129, and you will find an invitation to use your editing powers as a PCM to edit post 1. I have posted the EA and your indi (you might want to change back to ema) there, along with a template that sets up all five indi's. I am going to remove the EA from Doc's post 1 here.
Read the effing manual, ok?
Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.
I still suffer from OCCD. Good thing, really.
Anyone here feeling generous? My paypal account is always in the market for a tiny donation. pianodoodler@hotmail.com is the account.
To see The Weekly Roundup of stuff you guys might have missed Click here
My special thanks to Thomas (tomele) for all the incredible work he does here.
Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.
I still suffer from OCCD. Good thing, really.
Anyone here feeling generous? My paypal account is always in the market for a tiny donation. pianodoodler@hotmail.com is the account.
To see The Weekly Roundup of stuff you guys might have missed Click here
My special thanks to Thomas (tomele) for all the incredible work he does here.
- fxozgirl
- Trader
- Posts: 1176
- Joined: Wed Nov 16, 2011 9:16 am
- Location: Melbourne, Australia
Re: Ducks In A Row
I'll be definitely having a look at this one,
Thanks Doc for sharing, Steve, George & crew for your efforts in coding
Thanks Doc for sharing, Steve, George & crew for your efforts in coding