Pages:
Actions
  • #1 by AdamG on 01 Jul 2010
  • Hello all,

    I'm still quite new to MFP but am starting to work on my triggers. I seem to be misunderstanding the relationships between blocks being closed, repeating and how they affect the 'Affected By Trigger' expression.

    I've built a simple trigger file to test out my theories (file attached).
    It's one block with 3 triggers.

    Block: TestAffectedBy repeated no more often than 1 second
    <explanation: I want this block to run each time the market data is refreshed>

    Trigger:
    Action: Back
    Price: back_price
    Amount: default_backa
    At In Play: Cancel
    Markets: All Markets
    Market Status: Not In-play
    Execute No more often than 1 second
    Selections: All matching selections
    Trigger Name; Backing
    Conditions: Are met
      Any Selections Index is equal to 1
      And Fitting Selections Back Matched is equal to lay_matched
    <My Attempted Explanation: Back the first runner for the default amount before the off if there are no outstanding lays or backs>

    Trigger:
    Action: Set user variable
    Markets: All Markets
    Market Status:Not In-play
    Execute: No more often than 1 second
    Name: the_lay_price
    Value: lay_price
    Selections: All matching Selections
    Trigger Name: SaveLayPrice
    Conditions
      Any Selection's Affected by Trigger Backing <Note the lack of 'overall'>
    <My attempted Explanation: When a selection is backed by trigger 'Backing' save the lay_price into the variable 'the_lay_price'>

    Trigger:
    Action: Close Block TestAffectedBy
    Markets: All Markets
    Market Status: Not In-play
    Execute: No more often than 1 second
    Selections: All Matching selections
    Trigger Name:TestAffectedByClose
    Conditions: Any selections affected by trigger Backing
    <My attempted Explanation: If a selection has been backed, then we're done and ready to start over again>

    What I was expecting while watching the user variable 'the_lay_price' was for it to be uninitiated at first, the the Backing trigger would pick the first runner and back it. The 'the_lay_price' would then contain the lay_price at the point of backing. The block would then 'loop' on each refresh not doing anything until I manually lay'd the same selection to allow the 'Backing' trigger to fire again.

    What I'm actually seeing is the 'Backing' trigger behaving as I expected. It backs a selection and then waits for me to manually lay it, then it backs again.
    The Set User variable is not doing what I expected it to. It correctly sets the 'the_lay_price' on the first 'Backing' trigger as expected. It then updates this variable each time the market is refreshed.
    As I omitted the 'Overall' option I would not expect it to constantly update the variable as the 'Backing' trigger hasn't executed on the other refreshes.

    Anyone got any ideas as to what I'm doing wrong here?
    Any help or insight much appreciated
    Thanks
    -Adam
  • #2 by mcbee on 01 Jul 2010
  • hi
    maybe you should have your ( set user variable ), set to once per market.
    this will repeat as the block closes


    mcbee
  • #3 by AdamG on 01 Jul 2010
  •  :-[ <Slaps hand on face>

    mcbee, that worked! It was that simple? That also clears up some of my confusion about how the blocks get opened and closed.

    Also, calling a variable 'something_lay_price' causes fun and games as the view variables pop-up will render this as 'something_4.5' as the 'lay_price' portion gets swapped out for the current price.

    2 lessons learned for the price of 1!
    Thanks a lot for your help
    -Adam
  • #4 by mcbee on 01 Jul 2010
  • hi
    when using user variables you don't need the _ inbetween .
    this way it is not linked with mfp set variables


    mcbee
Pages:
Actions