Pivoty Slope

Share your 10.x automated traders here.
Post Reply
Jimdandy
Trader
Posts: 22
Joined: Fri Jul 20, 2012 3:14 am

Re: Pivoty Slope

Post by Jimdandy »

I'm trying to figure out what i'm missing here...

if (EnforcePivotCross && (iOpen(NULL, PivotCrossTimeFrame, 1) <= DailyPivot || iClose(NULL, PivotCrossTimeFrame, 2) >= DailyPivot) ) SendLong = false;

We've got the current candle in progress.. 0
The last candle completed.. 1
and Candle before that 2

.....So I would think that if the last candle (1) opened below pivot and (1) closed above pivot that would be a cross for a long...

.....But if I understand this line.. (and apparently i don't) it says
If the last candle (1) opened below the pivot... OR if the candle before last (2) closed above the pivot... kill the long signal.

.....So if crossing candle is the last candle (1) it opens below the pivot before it crossed.... it would kill the long.

.....If one candle later when the crossing candle is now candle 2.... since it closed above the pivot it still would still kill the long.

.....Yet another candle passes, now the crossing candle is candle 3 .. out of the picture.. candle 1 opens above the pivot so it passes the test... however candle 2 closes above the pivot so again the long is killed......... there is something simple that I am missing here. How does it ever take a trade with this enabled?

It just seems to me that this says... you can take a long if candle 1 opened above the pivot and candle 2 closed below it. Which is kind of hard to do since candle 1 opens at the SAME PRICE that candle 2 closes. unless........ there is a gap over the weekend from the close of candle 2 to the open of candle 1
... or.... candle 2 is at the end of OLD day and candle 1 is above a NEW daily pivot.

Someone enlighten me please...... PipPip....Jimdandy
User avatar
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: Pivoty Slope

Post by SteveHopwood »

Jimdandy wrote:I'm trying to figure out what i'm missing here...

if (EnforcePivotCross && (iOpen(NULL, PivotCrossTimeFrame, 1) <= DailyPivot || iClose(NULL, PivotCrossTimeFrame, 2) >= DailyPivot) ) SendLong = false;

We've got the current candle in progress.. 0
The last candle completed.. 1
and Candle before that 2

.....So I would think that if the last candle (1) opened below pivot and (1) closed above pivot that would be a cross for a long...

.....But if I understand this line.. (and apparently i don't) it says
If the last candle (1) opened below the pivot... OR if the candle before last (2) closed above the pivot... kill the long signal.

.....So if crossing candle is the last candle (1) it opens below the pivot before it crossed.... it would kill the long.

.....If one candle later when the crossing candle is now candle 2.... since it closed above the pivot it still would still kill the long.

.....Yet another candle passes, now the crossing candle is candle 3 .. out of the picture.. candle 1 opens above the pivot so it passes the test... however candle 2 closes above the pivot so again the long is killed......... there is something simple that I am missing here. How does it ever take a trade with this enabled?

It just seems to me that this says... you can take a long if candle 1 opened above the pivot and candle 2 closed below it. Which is kind of hard to do since candle 1 opens at the SAME PRICE that candle 2 closes. unless........ there is a gap over the weekend from the close of candle 2 to the open of candle 1
... or.... candle 2 is at the end of OLD day and candle 1 is above a NEW daily pivot.

Someone enlighten me please...... PipPip....Jimdandy
Nice one Jim. Thanks.

I glowered at the offending code for quite some time, demanding that it tell me why I had coded it thus. It refused to reply and continued watching the telly. Not a hint of guilt in sight. The code iself is clearly innocent, unless it is a supreme actor.

So, I guess I just plain got it wrong. No doubt the iClose(NULL, PivotCrossTimeFrame, 2) >= DailyPivot) made sense at the time, but it sure makes none right now, so V 1a is in post 1.

V 1a comes with a Steve Health Warning. I have a piano recital tomorrow and have been doing a lot of practise in prep for it. The sort of intensity I have brought to this is exhausting, both physically and emotionally.

On top of this, came a couple of glasses of dinner wine and I am half-way through a large tumbler of Scotch.

Then I coded the fix that I have added to post 1.

'nough said?

:D
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.
Jimdandy
Trader
Posts: 22
Joined: Fri Jul 20, 2012 3:14 am

Re: Pivoty Slope

Post by Jimdandy »

I can see why when you set it to true it greatly reduced the number of trades it took..... now can you explain that circle of fifths thingy to me? PipPip.. Jimdandy....

p.s. I have another ea that is doing the same thing with the stoploss error.. it's when it's moved to breakeven and is still trying to do it again even though the code plainly says RETURN if its already been done.... got to figure that one out next...
User avatar
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: Pivoty Slope

Post by SteveHopwood »

Jimdandy wrote:I can see why when you set it to true it greatly reduced the number of trades it took..... now can you explain that circle of fifths thingy to me? PipPip.. Jimdandy....

p.s. I have another ea that is doing the same thing with the stoploss error.. it's when it's moved to breakeven and is still trying to do it again even though the code plainly says RETURN if its already been done.... got to figure that one out next...
That is because Crapq4 does strange things to doubles sometimes, but does not handle the result properly. If A = 100 and B = 100, then they are equal, but Empty4 might turn B into 100.0000001, making them unequal.

This is where Gary's CloseEnough() comes in:

Code: Select all

bool CloseEnough(double num1, double num2)
{
   /*
   This function addresses the problem of the way in which mql4 compares doubles. It often messes up the 8th
   decimal point.
   For example, if A = 1.5 and B = 1.5, then these numbers are clearly equal. Unseen by the coder, mql4 may
   actually be giving B the value of 1.50000001, and so the variable are not equal, even though they are.
   This nice little quirk explains some of the problems I have endured in the past when comparing doubles. This
   is common to a lot of program languages, so watch out for it if you program elsewhere.
   Gary (garyfritz) offered this solution, so our thanks to him.
   */
   
   if (num1 == 0 && num2 == 0) return(true); //0==0
   if (MathAbs(num1 - num2) / (num1 + num2) < 0.00000001) return(true);
   
   //Doubles are unequal
   return(false);

}//End bool CloseEnough(double num1, double num2)
Then the call is, for example:
if (CloseEnough(NewStop, OrderStopLoss()) ) return;

:D
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.
Jimdandy
Trader
Posts: 22
Joined: Fri Jul 20, 2012 3:14 am

Re: Pivoty Slope

Post by Jimdandy »

........Yea I had an Aha moment when I read Gary's explanation of this problem and thanked him for it on down the thread.... but uh..... well..... I almost hate to bring it up.. but I think ........

.....if (EnforcePivotCross && iClose(NULL, PivotCrossTimeFrame, 1) >= DailyPivot) SendLong = false;

.....should be :

.....if (EnforcePivotCross && iClose(NULL, PivotCrossTimeFrame, 1) <= DailyPivot) SendLong = false;

.....if the last candle closed BELOW the pivot we should cancel the long should we not?

..... or have I just not had enough scotch yet to make this work? I mean if I have to drink scotch I'll do it... i'm willing to make that sacrifice..... the liquor store is only a half mile away and I have running shoes. :-D

Here I go....PipPip.....JimDandy.
User avatar
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: Pivoty Slope

Post by SteveHopwood »

Jimdandy wrote:........Yea I had an Aha moment when I read Gary's explanation of this problem and thanked him for it on down the thread.... but uh..... well..... I almost hate to bring it up.. but I think ........

.....if (EnforcePivotCross && iClose(NULL, PivotCrossTimeFrame, 1) >= DailyPivot) SendLong = false;

.....should be :

.....if (EnforcePivotCross && iClose(NULL, PivotCrossTimeFrame, 1) <= DailyPivot) SendLong = false;

.....if the last candle closed BELOW the pivot we should cancel the long should we not?

..... or have I just not had enough scotch yet to make this work? I mean if I have to drink scotch I'll do it... i'm willing to make that sacrifice..... the liquor store is only a half mile away and I have running shoes. :-D

Here I go....PipPip.....JimDandy.
Nope. The market has to have crossed the pivot, so the previous candle has to have closed below the pivot. If it closed above, then the market cannot have crossed it as it was already above.

Welcome to my world, Jim. Imbibe the scotch and it becomes less painful.

:D
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.
Jimdandy
Trader
Posts: 22
Joined: Fri Jul 20, 2012 3:14 am

Re: Pivoty Slope

Post by Jimdandy »

Ummm I'm not drinking enough apparently... I was thinking that for a long you want the market to cross from below to above the pivot...... when it finally does get above the pivot then the long was triggered... Let me get to imbibing.... Hope the recital went well.... PipPip.....JimDandy
User avatar
cuzgeorge
Trader
Posts: 674
Joined: Mon Mar 05, 2012 10:10 am
Location: Johannesburg, South Africa.

Re: Pivoty Slope

Post by cuzgeorge »

Hi all, :D
set this up for the week,
no SL/TP, BE at 20/10 and NO JStop.
link and pic attached.
regards
cuzgeorge

Image
You do not have the required permissions to view the files attached to this post.
10.X, BMac,Xmeter,Marylin,and CaptsNakedTrading thread coupled with Slowkeys Intraday setup for manual trades.
http://www.stevehopwoodforex.com/phpBB3 ... f=36&t=848
User avatar
cuzgeorge
Trader
Posts: 674
Joined: Mon Mar 05, 2012 10:10 am
Location: Johannesburg, South Africa.

Re: Pivoty Slope

Post by cuzgeorge »

Lowered the JS to 20 + BE.
Left BE at 20/10.
results are very promising.
Great work Steve.
10.X, BMac,Xmeter,Marylin,and CaptsNakedTrading thread coupled with Slowkeys Intraday setup for manual trades.
http://www.stevehopwoodforex.com/phpBB3 ... f=36&t=848
thelearner
Trader
Posts: 114
Joined: Tue Sep 11, 2012 9:35 am

Re: Pivoty Slope

Post by thelearner »

what TF is this EA originally made for? I believe NB10.2 runs on H4, CMIIW.
Can I bother someone to just send alert ONLY (I want to enter the position manually if I could so I can monitor). Thanks a lot... I like pivots because it doesn;t change with TF. So all traders watch the same line and avoid misinterpretation :)
Post Reply

Return to “10.x EA forum”