Calculating the price with the lowest money waiting

Advanced automation available in Guardian - Chat with others and share files here.
Post Reply
sniffer66
Posts: 1680
Joined: Thu May 02, 2019 8:37 am

I'm looking to return the price with the lowest money waiting within x ticks of the current price, outside of the hardcoded 3 best prices that are available. Range would be 4-7 ticks away.

I believe I can get the money waiting at each price stored as a shared value but for the life of me I can't work out how I would then return the price with the lowest money waiting. Is that possible in Guardian ?

Thanks
sa7med
Posts: 800
Joined: Thu May 18, 2017 8:01 am

stored value for money waiting at each ( 4 to 7 ) ticks away from best, (ie moneyAt4Ticks, moneyAt5ticks, etc)

set a stored value to track money (moneyTracker) waiting (start it at a large number, ex: 100000)

then have 4 separate rules to check if each (moneyAt4Ticks, moneyAt5Ticks) is less than moneyTracker (set them at consecutive times) - if so, make that the new moneyTracker

Now for your betting rule (you would need 4 of them), each with a condition checking to see if the money waiting at its corresponding price is equal to the money tracker. The one that has the least money waiting will trigger.

Rather roundabout way of going about it, and not sure if there's a better way, but that should work. Perhaps someone with a better solution could weigh in.
sniffer66
Posts: 1680
Joined: Thu May 02, 2019 8:37 am

sa7med wrote:
Tue Jun 25, 2019 8:30 am
stored value for money waiting at each ( 4 to 7 ) ticks away from best, (ie moneyAt4Ticks, moneyAt5ticks, etc)

set a stored value to track money (moneyTracker) waiting (start it at a large number, ex: 100000)

then have 4 separate rules to check if each (moneyAt4Ticks, moneyAt5Ticks) is less than moneyTracker (set them at consecutive times) - if so, make that the new moneyTracker

Now for your betting rule (you would need 4 of them), each with a condition checking to see if the money waiting at its corresponding price is equal to the money tracker. The one that has the least money waiting will trigger.

Rather roundabout way of going about it, and not sure if there's a better way, but that should work. Perhaps someone with a better solution could weigh in.
OK, I think I got that.

Assess each money waiting SV in turn to see if its less than a random large number (moneyTracker in your example), if it is assign its value to the Moneytracker SV, then assess the next one and so on, re- assign if lower. At the end Money tracker SV will be the price of the lowest.
Bet as per the moneytracker SV

Thats great, thanks a lot ! Not sure I would have come to that on my own. I was looking at doing multiple compares somehow. So easy to script it but when you can only compare 2 values at a time it's a little convoluted.
Still getting my head around ways to achieve things.
sniffer66
Posts: 1680
Joined: Thu May 02, 2019 8:37 am

Just wanted to double check something....

Rules are addressed in order from top to bottom, previous rule has to complete prior to next rule being run ?
sa7med
Posts: 800
Joined: Thu May 18, 2017 8:01 am

sniffer66 wrote:
Tue Jun 25, 2019 10:47 am
Just wanted to double check something....

Rules are addressed in order from top to bottom, previous rule has to complete prior to next rule being run ?
Yes they would have to be done consecutively.
sniffer66
Posts: 1680
Joined: Thu May 02, 2019 8:37 am

Works perfectly as designed sa7med. Thanks again for the help :) . I've done for this for backing and laying now, just by reversing the usual values

Attaching in case it's of use to anyone.
You do not have the required permissions to view the files attached to this post.
Last edited by sniffer66 on Tue Jun 25, 2019 1:53 pm, edited 1 time in total.
sa7med
Posts: 800
Joined: Thu May 18, 2017 8:01 am

sniffer66 wrote:
Tue Jun 25, 2019 12:41 pm
Works perfectly as designed sa7med. Thanks again for the help :)

Attaching in case it's of use to anyone
Cheers glad I could help.
Post Reply

Return to “Bet Angel - Automation”