stevehopwoodforex.com
https://www.stevehopwoodforex.com/phpBB3/
Print view

Slopey Peaky Bob
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=5389
Page 5 of 84
Author:  nixxx [ Mon Apr 02, 2018 10:52 am ]
Post subject:  Slopey Peaky Bob

SteveHopwood » Thu Mar 22, 2018 7:43 pm wrote:
billv » Thu Mar 22, 2018 11:47 am wrote: I think I had this problem with POS
Have you tried showing all currency pairs in your Empty4's market watch?
Right click in market watch and select "show all".
Nice one. Thanks. :clap: :clap: :clap: :clap: I had forgotten this.

Code changes would make no difference. nixxx, you now know what to do.

:xm: :rocket:

Thank You guys but "Show All" doesn't help :(
Author:  SilverTrader [ Mon Apr 02, 2018 10:56 am ]
Post subject:  Slopey Peaky Bob

Hi Nixxx
I'm having the same issue even after trying the "Show All" option. Please let me know if you find a solution and I shall do the same if I can work out what the problem is?
Cheers
Wayne
Author:  SteveHopwood [ Mon Apr 02, 2018 4:04 pm ]
Post subject:  Slopey Peaky Bob

SilverTrader » Mon Apr 02, 2018 10:56 am wrote:Hi Nixxx
I'm having the same issue even after trying the "Show All" option. Please let me know if you find a solution and I shall do the same if I can work out what the problem is?
Cheers
Wayne
Try V 1b in post 1. I have added a teensy bit of code. I doubt this will help because the original code has been used gazillions of times, but give it a try and see.

Coders, go to void LookForTradingOpportunities(string symbol, int PairIndex). I have changed:
price = ask;

to

price = NormalizeDouble(MarketInfo(symbol, MODE_ASK), digits);

Ditto for the sell trade i.e.
price = NormalizeDouble(MarketInfo(symbol, MODE_BID), digits);

:xm: :rocket:
Author:  nixxx [ Wed Apr 04, 2018 12:37 pm ]
Post subject:  Slopey Peaky Bob

It dosn't help :( This problem occurs with OP_BUYSTOP and OP_SELLSTOP with this settings:
Author:  SilverTrader [ Wed Apr 04, 2018 12:54 pm ]
Post subject:  Slopey Peaky Bob

Hi Nixx

I also still have this problem, seems that when the EA tries to open trades as you note, there are just far too many digits after the .
Hope that I have explained that correctly, as I do not have Peaky running at the moment as I have closed it to look for a solution, but I am battling with this one? Sorry for not being able to assist further.

Example of what I am saying, in case it is relevant and helps is below and just to note, this is a Live account with Global Prime;

3 07:49:24.747 Slopey Peaky Bob USDTRY,H1: invalid price 131.32646667 for OrderSend function
0 07:49:24.747 Slopey Peaky Bob USDTRY,H1: EURJPY Slopey Peaky Bob OP_SELLSTOP order send failed with error(4107): invalid price parameter for trade function
3 07:49:26.777 Slopey Peaky Bob USDTRY,H1: invalid price 131.32646667 for OrderSend function
0 07:49:26.777 Slopey Peaky Bob USDTRY,H1: EURJPY Slopey Peaky Bob OP_SELLSTOP order send failed with error(4107): invalid price parameter for trade function
3 07:49:27.997 Slopey Peaky Bob USDTRY,H1: invalid price 131.32656667 for OrderSend function
0 07:49:27.997 Slopey Peaky Bob USDTRY,H1: EURJPY Slopey Peaky Bob OP_SELLSTOP order send failed with error(4107): invalid price parameter for trade function
3 07:49:34.904 Slopey Peaky Bob USDTRY,H1: invalid price 131.32656667 for OrderSend function
0 07:49:34.904 Slopey Peaky Bob USDTRY,H1: EURJPY Slopey Peaky Bob OP_SELLSTOP order send failed with error(4107): invalid price parameter for trade function
3 07:49:36.004 Slopey Peaky Bob USDTRY,H1: invalid price 131.32656667 for OrderSend function
0 07:49:36.004 Slopey Peaky Bob USDTRY,H1: EURJPY Slopey Peaky Bob OP_SELLSTOP order send failed with error(4107): invalid price parameter for trade function
3 07:49:36.914 Slopey Peaky Bob USDTRY,H1: invalid price 131.32656667 for OrderSend function
Author:  SteveHopwood [ Wed Apr 04, 2018 7:56 pm ]
Post subject:  Slopey Peaky Bob

Listen up guys, or I will start to get cross. You need an example of what happens when I get cross? Do say, and I will cheerfully oblige.

It may have escaped your notice, but the relevant bit of this forum's name is stevehopwoodforex.com

To me, this means the 24 or so cross pairs. Ok, so other kind coders have added the ability for my EA's to trade most of the exotics and probably a fair few lunatic pairs, but I bet this does not cover everything. Did this really not occur to you? Did you really not stop to think about this for a moment? Wow. Given my occasionally tetchy response to dimwitery, this is stupidity on a breathtaking scale.

Of course the bloody USDTRY is producing lunatic results. Stop trading it. Anyone else here experiencing the problem? Stop being so bloody stupid and drop the pair from your trading list.

I am seriously pissed at a couple of dimwits tonight. Their stupidity meant I actually wasted time addressing their moronic behaviour, thinking that there might just possibly be a fault in code that had in reality worked seamlessly and flawlessly for years. Did I ever mention, tangentially perhaps, how much this pisses me off? Maybe not for a while. Perhaps I am mellowing in my old age.

I mention it now. Bear in mind that I could easily un-mellow.

SilverTrader and nixx or whatever your bloody user names are, here is the deal; bother me again with your stupidity and I ban you. Your best interests are served by: bothering a different forum; staying very quiet for a very long time here, so I forget that you annoyed me.

Capiche?
Author:  SteveHopwood [ Wed Apr 04, 2018 10:23 pm ]
Post subject:  Slopey Peaky Bob

I might need to eat masses of humble pie tomorrow.

If you have been around here for a while, you will know that I am always prepared to eat my hat when I have goofed up big-time.

SilverTrader fought his corner in a post here tonight. I instantly removed his Battle-scarred-veterans status and moved him to the group of the great unwashed who can do bugger all here and deleted his post. I do not muck around when carrying out a threat - unless it is Gracie et al.

Thingy is, worrying about being unfair dragged my attention to a line of code that is clearly wrong. It is within this function:
bool DoesTradeExist(int type,double price)

The offending line of code is:
if(OrderSymbol()!=Symbol()) continue;

Coders of even beginning ability are screaming at the screen, "How could you miss that, you dimwit?"

The bool DoesTradeExist(int type,double price) checks that there is not already a trade open on the symbol in question at the current price - yet the function only tests that it does not exist on the chart the EA is loaded on. This could be a Slopey-wide problem, so check your code, folks.

I will fix this bloop tomorrow - it is gone 23.00 here in the UK and I am not certain that any fix I introduce will be of any benefit given my imbibedness.

I have no idea if fixing it will solve Nixx and ST's problem. Frankly, I doubt it but it is unfair to penalise you when you have inadvertently brought up a real problem. ST, you are restored to your former glory. ST and N, I apologise temporarily for being so rude to you.

And if the fix I add tomorrow works for everything you brought up here, then you can look forward to some Steve Grovelling.

:xm: :rocket:
Author:  SilverTrader [ Thu Apr 05, 2018 6:25 am ]
Post subject:  Slopey Peaky Bob

No need to grovel, we are all human and I do hope the issue is as easy as that to correct, but not being a coder I cannot assist unfortunatly other than to assist with what I percieve to be a problem.
Author:  SteveHopwood [ Thu Apr 05, 2018 10:19 am ]
Post subject:  Slopey Peaky Bob

V 1c is in post 1. I consider this to be an essential update as I failed to edit a function written for a single trader EA when adapting it to a multi-trader. I am surprised this has not caused problems.

DIYers, do a search for "bool DoesTradeExist(int type,double price)" . Replace this with:
bool DoesTradeExist(string symbol, int type,double price)

Scroll down to "if(OrderSymbol()!=Symbol()) continue;

You can see how this makes the function fail. Replace it with:
if(OrderSymbol()!=symbol) continue;

Recompile and follow the two error messages that crop up in the buy and sell grid sending functions:
Replace:
if(DoesTradeExist(type,price))

with
if(DoesTradeExist(symbol,type,price))

:xm: :rocket:
Author:  sherwind [ Thu Apr 05, 2018 5:40 pm ]
Post subject:  Slopey Peaky Bob

SilverTrader » Wed Apr 04, 2018 8:54 pm wrote:
3 07:49:24.747 Slopey Peaky Bob USDTRY,H1: invalid price 131.32646667 for OrderSend function
0 07:49:24.747 Slopey Peaky Bob USDTRY,H1: EURJPY Slopey Peaky Bob OP_SELLSTOP order send failed with error(4107): invalid price parameter for trade function
Hi,

It seems the error message came from the function SendSingleTrade().
That function is called by these other functions:

SendTrendTrade()
LookForTradingOpportunities()
ReadIndicatorValues()
SendBuyGrid()
SendSellGrid()

Since SendTrendTrade()and LookForTradingOpportunities() are using the ask/bid price directly,
and SendBuyGrid() and SendSellGrid() are normalizing the price before calling SendSingleTrade(),
I believe the issue is in ReadIndicatorValues().

Perhaps the fix is to replace line 2129

Code: Select all

 SendPrice = price - (DistanceBetweenTrades / factor); 
with

Code: Select all

 SendPrice = NormalizeDouble(price - (DistanceBetweenTrades / factor),digits); 

and replace line 2169

Code: Select all

 SendPrice = price + (DistanceBetweenTrades / factor); 
with

Code: Select all

SendPrice = NormalizeDouble(price + (DistanceBetweenTrades / factor),digits);

Hope this helps,

- Sherwin
All times are UTC Page 5 of 84