Author Topic: fire trigger based on condition  (Read 1974 times)

Tags:
  • All members
  • Posts: 314
fire trigger based on condition
« on: 01 May 2016, 08:34 »
Hi,

I have 2 profiles in place, one for Pre In Play, and another for In Play...

For each profile, I have 2 triggers in place, one fires to place a lay bet, and another places a back bet 3 ticks above the lay bet. Standard greenup.

I want to be able to add another trigger, to fire if the price goes a customizable number of ticks below the original lay price, as a stop loss, and only fire IF the greenup bet has not been filled.

Is it possible to look at the original lay bet and set a stop loss to fire if the greenup hasnt worked?

Thanks

Mark.


  • Moderator
  • Posts: 3597
*
Re: fire trigger based on condition
« Reply #1 on: 02 May 2016, 14:31 »
Hi
Use a condition in your stoploss trigger:
and trigger <name of your greenup trigger> number of runs per selection is equal to 0

I see you are backing with a formula for the greenup, so it might be easier to take care of the greenup or stoploss in the same trigger:
Constants:
profit_ticks
loss_ticks

back, price: back_price, amount: bm_laya*bm_layp/back_price
all matching selections
once per selection
Conditions:
selections lay matched is greater than 0
AND
      selections back price is equal or greater than r_ticks(bm_layp, profit_ticks)
      or selections back price is equal or less than r_ticks(bm_layp, -loss_ticks)

please use test mode to try it out.
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: 314
Re: fire trigger based on condition
« Reply #2 on: 04 May 2016, 18:35 »
Hi MarkV,

Thanks for the response.

That seems to have worked exactly as I hoped. I could not quite get my head round everything you wrote in the post, BUT, by just using 2 simple triggers, I have tested it, and it does both gain, and stops, or loss and stops. Thank you so much! I still dont quite understand why it doesnt carry on betting, for example if the price reaches the greenup level, it places the bet and the greenup is fulfilled, but then the price falls to at or below the stop loss level, but it doesnt place another bet - in fact, why doesnt it just keep betting at these levels, because there doesnt seem to be a condition in there to tell it to stop - I know I am lacking in my understanding, but if I don't ask the question, I will never know....

I now want to take it one step further.

I want to be able to determine the distance of the race, and then have a condition in the trigger, such as have the greenup bet in place throughout, until it matches (or not), AND have the stop loss only kick in after a configurable number of seconds.

So, if its a 3 mile race, then look to place the stop loss after 90 seconds, 2 mile race, after 40 seconds etc. Of course if ts a 6 furlong, then no time check...

Is that possible?

Thanks

Mark.

  • Moderator
  • Posts: 3597
*
Re: fire trigger based on condition
« Reply #3 on: 04 May 2016, 20:33 »
Hi
Not sure I understand your first question, either the greenup happens and every selection is greened up and in profit, end of trade and no stoploss required. Or the stoploss happens?

Several ways of determining race distance etc. There is a variable market_length you can use, or perhaps a condition block something like this:

AND
     OR
        markets name contains "1m2f"
        and markets minutes since the off is greater than 0.50
     OR
        markets name contains "3m2f"
        and markets minutes since the off is greater than 1.50
     OR
        etc....
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: 314
Re: fire trigger based on condition
« Reply #4 on: 05 May 2016, 10:27 »
Hi
Not sure I understand your first question, either the greenup happens and every selection is greened up and in profit, end of trade and no stoploss required. Or the stoploss happens?

Several ways of determining race distance etc. There is a variable market_length you can use, or perhaps a condition block something like this:

AND
     OR
        markets name contains "1m2f"
        and markets minutes since the off is greater than 0.50
     OR
        markets name contains "3m2f"
        and markets minutes since the off is greater than 1.50
     OR
        etc....

hi MarkV,

Thanks for your help.

I am now looking at what you have given me, and have not yet looked or applied any proper analytical logic to the timings, but I am planning to test my theories with a view to improving over time. But first, I need to get the code right..

It is easier for me to program the triggers using the XML constructs used by MFP, rather than the programming interface, because XML is so much easier. So I have attached an XML view of my trigger.

I have not yet tried any of this out yet, and as there are so many race distances, I wanted to display only a few of these and ask if my trigger will work. I think my main concern is that will I be able to assign a variable name _26f with its corresponding value of "3m2f" and use this in my conditional blocks?

See image

Thanks

Mark.

  • Moderator
  • Posts: 3597
*
Re: fire trigger based on condition
« Reply #5 on: 05 May 2016, 15:47 »
Hi
I'm afraid I can't help you with the xml, and would certainly recommend using the Trigger Editor to construct triggers for MarketFeeder. The attached screenshot shows what I wrote in the previous post as a condition block in the Editor. You can test it with a few race distances and then add more when you are happy with how it works.

The principle of condition blocks is described in the Help File, which is available on the question mark icon, towards the top right of the editor window, and also top right of the program window. A downloadable pdf is here: http://marketfeederpro.com/download/MF8_manual_eng.pdf

I would also suggest if you would like to have your trigger written for you by a trigger developer, please put in your request here. You have a quota of free triggers available to you.
https://community.welldonesoft.com/marketfeeder-make-me-a-trigger/
 
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: fire trigger based on condition
« Reply #6 on: 05 May 2016, 17:37 »
hi
if you request a trigger and include your betting trigger i can add a set of triggers to record the race times start to finish based on time to finish.

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.

  • All members
  • Posts: 314
Re: fire trigger based on condition
« Reply #7 on: 05 May 2016, 22:48 »
hi to both MarkV and mcbee,

I will say that this post has helped me out significantly, so I thank you for that.

I accept that you would prefer me to use the MFP trigger editor, and this is always how I will START off, but once I have seen the ID's associated with each command, etc, I can then translate what I want into XML, which of course is the final format of the triggers. So, I will continue to use this approach.

My trigger is now quite large, although it is in the same format as that shown in your attached image. I have added OR blocks with AND conditions, which are effectively multiple sections of the below...

OR
  Market's Name contains <variable_for_distance_1>
  AND Market's Minutes since the Off is equal to or greater <variable_time_for_variable_for_distance_1>
  AND Selection's Back Price is equal or less than r_ticks(bm_layp, -lossTicks)
OR
  Market's Name contains <variable_for_distance_2>
  AND Market's Minutes since the Off is equal to or greater <variable_time_for_variable_for_distance_2>
  AND Selection's Back Price is equal or less than r_ticks(bm_layp, -lossTicks)
OR
  3,
OR
  4, etc, etc

I have tried this today, and it has done as expected, I included every single race distance from 5 furlongs to 32 furlongs, by increments of 1 furlong (5f, 6f, 7f, 1m, 1m1f, 1m2f, etc - and I think that will cover ALL, and probably some that don't exist.


mcbee, FYI, I do not think that there is anything wrong with the trigger you developed for me, BUT, for some reason, I cannot get it to work. I can tell you that the new trigger, which has been developed from both MarkV's help, and I stole some of the trigger code you wrote for me, and this is now in place, and on test, and it does indeed work with the selections list format I sent you. I do like to provide info in each of the lists which contains race time and course on one line, and then Horse name on the next line. I also use speech marks for a horse name which contains spaces, I think I got that info from here. MFP will ignore the time and course, because that is not a selection present in the days races. Of course, when I first started this, I used only a selection per line, without any other info, and then by accident, I named a horse wrong, and MFP didn't bet on it, which of course made me understand that any data MFP does not recognise, it will ignore, and so, in order to allow me to have more descriptive lists, I use as above, and it works fine.


Thanks again for all your help.

Mark.



 

Please note, BetFair is seems to be currently OFFLINE