| stevehopwoodforex.com https://www.stevehopwoodforex.com/phpBB3/ Print view |
|
| Pivoty Slope https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=723 |
Page 4 of 7 |
| Author: | trader689 [ Tue Jul 24, 2012 5:53 pm ] |
| Post subject: | Re: Pivoty Slope |
im also getting this error. Steve, any possibility of looking into the fix of code that EllisEdi has kindly posted and incorporating it into the next release?
|
|
| Author: | SteveHopwood [ Tue Jul 24, 2012 6:20 pm ] |
| Post subject: | Re: Pivoty Slope |
Nice one. Thanks. For those of you unable to make these changes yourself, I will update later. |
|
| Author: | SteveHopwood [ Tue Jul 24, 2012 10:37 pm ] |
| Post subject: | Re: Pivoty Slope |
Mark, I started to make the changes tonight then realised they do not make any sense. Declaring price as as NULL is irrelevant, because the function assigns the Bid or Ask to price, depending on the order type. What am I missing? |
|
| Author: | EllisEdi [ Wed Jul 25, 2012 12:49 am ] |
| Post subject: | Re: Pivoty Slope |
Actually, I set the stop =NULL because the if statements : if (StopLoss > 0) : this condition sets the return value "stop" only when StopLoss >0. So when when StopLoss is = 0 it returns ????? since stop is a double type i bet it gets set to something other than null when not explicitly set. (my guess is that it defaults to 0.000000001 or something strange like that (it could even default to 0, which would error as invalid stoploss i think). i have seen a couple of weird values when dealing with Empty4 and double variable type.) The function never actually sets the return variable "stop", when StopLoss is not > 0. So by setting it to NULL explicitly we end up passing NULL as the value of the StopLoss in the ordersend command sent to Empty4 broker, which in effect tells the Empty4 broker server there is no stoploss, which i believe was the intended effect. The same holds true for the TakeProfit... I hope i explained it well, sometimes I tend to be as clear as mud... --Mark |
|
| Author: | garyfritz [ Wed Jul 25, 2012 2:12 am ] |
| Post subject: | Re: Pivoty Slope |
Mark, either you're confused, or Steve and I are... You originally said you set *price* to NULL, and as Steve said, the first thing those functions do is set price to Bid or Ask. I think you intended to set *stop* to NULL? Then if StopLoss == 0, stop returns NULL, and you test stop for NULL later. Personally I would not initialize a double value to NULL. NULL isn't really a double value. I would initialize it explicitly to 0.0. Then you could check for 0.0 instead of checking for NULL -- except it turns out you don't really have to. If stop == 0, CalculateLotSize() returns Lot, and that's probably the right LotSize if there is no SL. But it would be more clear to explictly check for if (stop > 0 && RiskPercent > 0). So at a minimum you should set stop to NULL instead of price -- but I'd just set it to 0.0 and forget the other changes. |
|
| Author: | EllisEdi [ Wed Jul 25, 2012 2:11 pm ] |
| Post subject: | Re: Pivoty Slope |
Sorry, You are right I am confused ... I only set price = null because it was declared in same statement. I did not mean to set that, but as you both have said it does get reset to its proper value so initialzation does not hurt it. The stop value was what I was looking at because, at first glance, it appeared to be the root cause of the error130. What I implemented only fixed the error that was occurring on the invalid stopLoss (a workaround). I suppose the proper solution would be to initialize "stop" to Zero, then after stop was calculated, a check if the value for the "stop" variable was far enough away from the criminals price that the criminal would accept it. If it is not far enough away from price, then set it to the minimum distance away. and finally a check to see if the "stop" variable is 0, then send a NULL in the stoploss field of the ordersend command. I did not look deep enough into the code to see if this was implemented. I only wanted to apply a HOTFIX to remove the error 130. This weekend when I have more time I was going to delve deeply into the code. I think now that I clearly read the post, we are all on the same page. Thanks. --Mark ps What is even worse is my fix did not stop the error 130 .. my testing was not good enough and coincidence paused the error 130 ... I am crazy old man ... |
|
| Author: | garyfritz [ Wed Jul 25, 2012 3:12 pm ] |
| Post subject: | Re: Pivoty Slope |
Well you are in good company around here!! |
|
| Author: | grimweasel [ Wed Jul 25, 2012 10:01 pm ] |
| Post subject: | Re: Pivoty Slope |
Thanks Ellis and Steve for trying. I was only getting the error once the trade went into profit and tried to adjust the stop, looking at the charts. I have turned off ALL stop loss functions in the EA and have no problems (of course) at the moment. Maybe it's a broker issue? I'm using FXCM in the UK? |
|
| Author: | Bunker [ Wed Jul 25, 2012 10:17 pm ] |
| Post subject: | Re: Pivoty Slope |
Same here. 2 demos with FXCM UK (Pivoty and Stretchy). Had the error on both EAs until I re-compiled using Ellis changes. It did the trick for me. EDIT: Spoke too fast. The error reappeared. Sorry. I will try with another crim. |
|
| Author: | grimweasel [ Sun Jul 29, 2012 3:02 pm ] |
| Post subject: | Re: Pivoty Slope |
Gotta her one RJo! |
|
| All times are UTC | Page 4 of 7 |
|
Powered by phpBB® Forum Software © phpBB Limited |
|