| stevehopwoodforex.com https://www.stevehopwoodforex.com/phpBB3/ Print view |
|
| Help with coding, something really strange https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=5855 |
Page 1 of 1 |
| Author: | LittleCaro [ Mon Jun 08, 2020 3:35 pm ] |
| Post subject: | Help with coding, something really strange |
Hello guys, I'm facing a really strange thing, that's several days i'm on it, and well ... Here is the thing : i create something really basic with Steve's shell. I want to set pending order + x pips to the high of the previous candle, the thing it : It's working with High[0] and High[2], BUT it's not working with High[1] the one that i'm interested in. The expert says error 130 invalid stops, and that's the same stops used with High[0] and High[2] Maybe some of our geniuses can look at it. Here is the code : Code: Select all Code: Select all |
|
| Author: | LittleCaro [ Mon Jun 08, 2020 5:25 pm ] |
| Post subject: | Help with coding, something really strange |
Hey guys, When i was under my shower, i find partly a solution : It's the setting : PostTradeAttemptWaitSecond, if i put it to zero, it works. But now i have another problem, the limit order stays active for only 1 bar if he isn't triggerded, after he gets deleted. You put a security to delete the pendings ? I looked through the code and find nothing ? |
|
| Author: | SteveHopwood [ Mon Jun 08, 2020 7:12 pm ] |
| Post subject: | Help with coding, something really strange |
Good for you for getting your hands dirty by looking under the bonnet of CrapQl4. Re this: price = High[1] + (PipsAdjust/factor); Supposing the market had fallen by the time your EA tries to execute this code. You could be trying to send a limit order at an impossible price because the market is already lower than your limit price. You need to check that 'price' is below the current market price so that a limit order is possible. From there, you either abort the trade or send a stop order. Assuming you are happy to send a stop order, then the construct would be this: type = BUYLIMIT; price = High[1] + (PipsAdjust/factor); if (price > Ask)//In English to follow {
Up an at 'em, Tiger. I hope this helps. Ask away if not. |
|
| Author: | SteveHopwood [ Mon Jun 08, 2020 7:22 pm ] |
| Post subject: | Help with coding, something really strange |
Not that I can think of. Try my latest and see, then I will take a look if need be. |
|
| Author: | LittleCaro [ Tue Jun 09, 2020 7:42 am ] |
| Post subject: | Help with coding, something really strange |
Hello Steve, Thanks a lot for all your help. I restarted from zero, with your latest shell code. And all is working good. I also realized that i made a mistake between stop and limit orders. Sometimes i'm so silly Thanks for all ! |
|
| Author: | tzaro1 [ Wed Nov 03, 2021 2:04 pm ] |
| Post subject: | Help with coding, something really strange |
Hi, glad you got it worked out. Regarding 1 bar expiry, the limit/ stop orders in Empty4 use an additional parameter variable of the type 'datetime'. It is the 2nd to last one and between magic number and color. Hope that helps. |
|
| All times are UTC | Page 1 of 1 |
|
Powered by phpBB® Forum Software © phpBB Limited |
|