Author Topic: 1 click trade out button "What If" P/L  (Read 7477 times)

Tags:
  • Moderator
  • Posts: 3597
*
1 click trade out button "What If" P/L
« on: 21 Aug 2013, 11:33 »
Hi
This has been asked here before, but I did not see a solution.

On the ladder interface and in Engineer Mode 1-click trade-out button, there is an updating figure showing the "What If" P/L for the selection if you were to click the button and trade out at that moment.

I would like to use that figure in a trigger condition.

For an initial back bet I have:
bm_backp
bm_backa
lay_price
what would be the formula to generate the What If P/L?

For an initial lay bet I have:
bm_layp
bm_laya
back_price
what would be the formula to generate the What If P/L?
Please read the following disclaimer with regards to the information you may request and obtain on our forum. This specifically concerns trigger files and various instructions as to how to implement a strategy.

  • Élite
  • Posts: 3698
  • Gender: Male
*
Re: 1 click trade out button "What If" P/L
« Reply #1 on: 21 Aug 2013, 13:52 »
hi
it is, for the bet amount.
back amount divided by the total of back price divided by lay price.
so if you had a back bet of 4 euro at 3.10 odds with a lay price of 3.25 , you would calculate.
4/(3.10/3.25)
for the profit/loss
-(((bm_backa/(lay_price/bm_backp))*(lay_price-1))-(bm_backa*(bm_backp-1)))

mcbee

corrected
Please read the following  disclaimer with regards to the information you may request and obtain on our forum. This specifically concerns trigger files and various instructions as to how to implement a strategy.

  • Moderator
  • Posts: 3597
*
Re: 1 click trade out button "What If" P/L
« Reply #2 on: 21 Aug 2013, 14:37 »
Hi mcbee
Did I miss something? See attached.
Please read the following disclaimer with regards to the information you may request and obtain on our forum. This specifically concerns trigger files and various instructions as to how to implement a strategy.

  • Élite
  • Posts: 3698
  • Gender: Male
*
Re: 1 click trade out button "What If" P/L
« Reply #3 on: 21 Aug 2013, 14:46 »
hi
ooop's sorry
the profit and loss amount should have been
-(((bm_backa/(lay_price/bm_backp))*(lay_price-1))-(bm_backa*(bm_backp-1)))

my brain hurts now



mcbee

corrected
Please read the following  disclaimer with regards to the information you may request and obtain on our forum. This specifically concerns trigger files and various instructions as to how to implement a strategy.

  • Élite
  • Posts: 3698
  • Gender: Male
*
Re: 1 click trade out button "What If" P/L
« Reply #4 on: 21 Aug 2013, 15:27 »
hi markv
sorry, i used a spreadsheet to do the calculations and then converted them to mfp format, but wrong.
here is the tested formula for the profit and loss figures, copy and paste to the variable screen.
-(((bm_backa/(lay_price/bm_backp))*(lay_price-1))-(bm_backa*(bm_backp-1)))

mcbee
Please read the following  disclaimer with regards to the information you may request and obtain on our forum. This specifically concerns trigger files and various instructions as to how to implement a strategy.

  • Moderator
  • Posts: 3597
*
Re: 1 click trade out button "What If" P/L
« Reply #5 on: 21 Aug 2013, 15:35 »
Perfect mcbee - much obliged.
Sorry for the headache.
cheers
Please read the following disclaimer with regards to the information you may request and obtain on our forum. This specifically concerns trigger files and various instructions as to how to implement a strategy.

  • Moderator
  • Posts: 3597
*
Re: 1 click trade out button "What If" P/L
« Reply #6 on: 21 Aug 2013, 16:14 »
mcbee, if it's not too much trouble, please could you post up the same for an initial lay bet.
cheers
Please read the following disclaimer with regards to the information you may request and obtain on our forum. This specifically concerns trigger files and various instructions as to how to implement a strategy.

  • Élite
  • Posts: 3698
  • Gender: Male
*
Re: 1 click trade out button "What If" P/L
« Reply #7 on: 21 Aug 2013, 17:20 »
hi
i thought at first it would be the same but no, here is the formula.
-(((bm_laya/(bm_layp/back_price))*(bm_layp-1))-(bm_laya*(back_price-1)))


mcbee
Please read the following  disclaimer with regards to the information you may request and obtain on our forum. This specifically concerns trigger files and various instructions as to how to implement a strategy.

  • Moderator
  • Posts: 3597
*
Re: 1 click trade out button "What If" P/L
« Reply #8 on: 22 Aug 2013, 19:54 »
Hi mcbee
The formula for the initial lay does not seem to be right, see attached. When you get a moment please could you take a look.
thanks
Please read the following disclaimer with regards to the information you may request and obtain on our forum. This specifically concerns trigger files and various instructions as to how to implement a strategy.

  • All members
  • Posts: 490
  • Gender: Male
Re: 1 click trade out button "What If" P/L
« Reply #9 on: 22 Aug 2013, 21:52 »
Sorry for joining in but isn't your initial bet what you chose. It could be fixed amount or fixed risk?

If it was a back bet I then this as the amount formula for the lay bet. (Note it is one tick below the bm_backp.

bm_backp/r_ticks(bm_backp,-1)*bm_backa => this is the lay amount formula
eg: 2.0/1.99*100 where your initial back bet was $100 at 2.00

Conversely if you have an exposed lay bet it will be

bm_layp/r_ticks(bm_layp,1)*bm_laya => this is the back amount formula

adjust the r_ticks for how many ticks you want to differentiate.
 
Improvise Adapt Overcome

  • Moderator
  • Posts: 3597
*
Re: 1 click trade out button "What If" P/L
« Reply #10 on: 23 Aug 2013, 06:13 »
Thanks londolozi.
What I am after is the formula for the running total of the "What If P/L", (if you were to trade out at that moment), as shown on the ladder interface and also shown on the one-click trade-out button in Engineer Mode. See attached screenshot for an example.

mcbee has kindly provided the formula for the "What If" for an opening back bet. The formula for the "What If" for an opening lay bet has a fault.
cheers
Please read the following disclaimer with regards to the information you may request and obtain on our forum. This specifically concerns trigger files and various instructions as to how to implement a strategy.

  • All members
  • Posts: 490
  • Gender: Male
Re: 1 click trade out button "What If" P/L
« Reply #11 on: 23 Aug 2013, 08:17 »
I calculate it will be this

(bm_laya*(bm_layp-1)*-1)+((back_price-1)*(bm_layp/back_price*bm_laya))

Complete the other half of the trigger for me, what formula is best used for the initial entry bet ie picking the low price.

I think we need to reverse it and come in with a back bet first. Less bank liability issues.
more later....



Improvise Adapt Overcome

  • Élite
  • Posts: 3698
  • Gender: Male
*
Re: 1 click trade out button "What If" P/L
« Reply #12 on: 23 Aug 2013, 09:13 »
hi mark
sorry i have been on antibiotics for 6 days and the last 2 days was ok, but now i am back to what i was 3 weeks ago, no sleep and very loose toilet, it takes the strength and concentration out of you day after day.
here is the formula for the lay.
 (((bm_laya/(back_price/bm_layp))*(back_price-1))-(bm_laya*(bm_layp-1)))

mcbee
Please read the following  disclaimer with regards to the information you may request and obtain on our forum. This specifically concerns trigger files and various instructions as to how to implement a strategy.

  • Moderator
  • Posts: 3597
*
Re: 1 click trade out button "What If" P/L
« Reply #13 on: 23 Aug 2013, 10:06 »
Hi londolozi and mcbee

thanks very much for your help. Both formulas produce the correct result.

For info this is what I am trying to achieve.

The trigger in this topic:
http://community.welldonesoft.com/triggered-betting-10/martin_overs/
There is a lay bet in each of the markets here which recovers the loss from the previous market.

I want to green up if:

what if p/l is greater than all losses so far

selection's trigger expression <what if p/l> is greater than (init_bet - (ou0_market_parent_id_1_profit_loss + ou1_market_parent_id_1_profit_loss + ou2_market_parent_id_1_profit_loss))/(1-commission)

mcbee's formula in the condition
selection's trigger expression (((bm_laya/(back_price/bm_layp))*(back_price-1))-(bm_laya*(bm_layp-1))) is greater than (init_bet - (ou0_market_parent_id_1_profit_loss + ou1_market_parent_id_1_profit_loss + ou2_market_parent_id_1_profit_loss))/(1-commission)

londolozi's formula in the condition
selection's trigger expression (bm_laya*(bm_layp-1)*-1)+((back_price-1)*(bm_layp/back_price*bm_laya)) is greater than (init_bet - (ou0_market_parent_id_1_profit_loss + ou1_market_parent_id_1_profit_loss + ou2_market_parent_id_1_profit_loss))/(1-commission)

thanks chaps. I will test them as soon as some markets are inplay

mcbee - wish you well soon.

PS it strikes me that the "What If P/L" would be very useful to have as a variable for use in triggers. I will post accordingly in suggestions.
Please read the following disclaimer with regards to the information you may request and obtain on our forum. This specifically concerns trigger files and various instructions as to how to implement a strategy.

 

Please note, BetFair is seems to be currently OFFLINE