Pages:
Actions
  • #1 by sendandreturn74 on 07 Oct 2016
  • Hi,
    I have this parsing correctly..

    IF ((g_ticks(lastunmatchedlayprice,lay_price)>gap), r_ticks(lastunmatchedlayprice,3), r_ticks(lastunmatchedlayprice,1))

    as I see for example at any one time

    IF (7>3, 1.96, 1.94)

    How can I can gain access to the result..? i.e 1.96 or 1.94 and get it as a variable...

    I have tried setting a user variable with the value of IF ((g_ticks(lastunmatchedlayprice,lay_price)>gap), r_ticks(lastunmatchedlayprice,3), r_ticks(lastunmatchedlayprice,1))

    but it doesn't seem to do anything...

    thanks..

  • #2 by MarkV on 07 Oct 2016
  • Hi
    when I tested it, it did not parse, result was, using your example:
    IF ((7>3), 1.96, 1.94)

    using bu_layp instead of lastunmatchedlayprice and removing the one set of brackets, this parses correctly and can be written to a user variable:
    IF(g_ticks(bu_layp,lay_price)>3, r_ticks(bu_layp,3), r_ticks(bu_layp,1))
  • #3 by Oxa (WellDoneSoft) on 07 Oct 2016
  • So, like MarkV says, check that your variable lastunmatchedlayprice is set correctly.
  • #4 by sendandreturn74 on 07 Oct 2016
  • Cheers guys...

    Is it possible to have AND statements in IF statements....like

    IF(THIS AND THAT), X, Y)
  • #5 by MarkV on 08 Oct 2016
  • Hi
    Certainly, here's an example from the helpfile:
    IF(AND(last_won>=0, total_won>0), 4.0, IF(last_won<0, 4-last_won))
  • #6 by sendandreturn74 on 09 Oct 2016
  • thank you.. and if I wanted to add multiple and checks

    IF(AND(this>500,that<100)OR(whatever>X, thatever<Y), r_ticks(back_price,1), back_price)

    would that work?
  • #7 by MarkV on 09 Oct 2016
  • Hi
    Yes IF, AND, OR functions are supported.
  • #8 by sendandreturn74 on 09 Oct 2016
  • Ah cool, so the syntax I used above would be ok?
  • #9 by MarkV on 09 Oct 2016
  • Hi
    I think one of these depending on your requirement:
    IF(AND(AND(this>500,that<100),OR(whatever>X,thatever<Y)),r_ticks(back_price,1),back_price)
    IF(OR(AND(this>500,that<100),OR(whatever>X,thatever<Y)),r_ticks(back_price,1),back_price)
  • #10 by sendandreturn74 on 10 Oct 2016
  • Thanks MarkV,

    Is there a way of having three results within an IF, more than the bollean result of true or false..

    IF (this, X), (OR that, Y), (OR whatever, Z)
  • #11 by MarkV on 10 Oct 2016
  • Hi
    A nested IF could be a possible. The are several topics on the forum relating to "nested IF". The nested IF could just as well be a nested OR, or a nested AND, or any combination. It really depends on your end result required, I'd say probably a lot easier to use trigger conditions for this.
Pages:
Actions