Fabulous spot Sherwin. Thank you very much.sherwind » Thu Apr 05, 2018 5:40 pm wrote:
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 2129withCode: Select all
SendPrice = price - (DistanceBetweenTrades / factor);Code: Select all
SendPrice = NormalizeDouble(price - (DistanceBetweenTrades / factor),digits);
and replace line 2169withCode: Select all
SendPrice = price + (DistanceBetweenTrades / factor);Code: Select all
SendPrice = NormalizeDouble(price + (DistanceBetweenTrades / factor),digits);
Hope this helps,
- Sherwin
There is the fix in V 1d in post 1. DIYers, you already know how to add the fix.
Here is a lesson for all of us coders. I thought I had identified all opportunities to normalise a double, yet still missed two of them. Here is the lesson: NormalizeDouble every calculation involving a double even when there is absolutely, positively, definitively NO chance of the calculation falling foul of the eighth digit thingy in Empty4. Just Normalize it, OK?
Sherwin, your contribution wins you instant membership of the Grumpy Ole Bastards' group and I welcome you. For all I know, you are a 13 year old coding genius giggling at the lunacy of Empty4 and rewriting it before breakfast in preparation for submitting it for your Doctorate this time next week. If so, give it half a century and you will have joined the rest of us, for sure.
To those of you who have been unaffected by the problems highlighted earlier and are wondering what all the fuss is about: it is better to have accurate coding than inaccurate coding, even if said inaccuracies have not harmed you yet. Just do the re-download, OK?
Now we come to the apology. I rule SHF by fear deliberately. My mods buy into this principle. Not everybody likes this but it serves useful purposes: it stops trolls dead in their tracks; It cuts out bullshit immediately it is posted; it keeps SHF a mine of useful information rather than the morass of pointless dead ends that so many forums lead into.
Occasionally, it leaves me looking a total tit and this is one of them. Wayne, you kindly wrote earlier that grovelling is not needed. I disagree, so here goes:
SilverTrader and nixxx: I deeply, humblingly and grovellingly apologise to both of you for my gratuitous abuse. I hope you can find it in your hearts to forgive me.