Author Topic: Moving Average (lt_ma)  (Read 451 times)

Tags:
  • All members
  • Posts: 5
  • Karma: +0/-0
  • Gender: Male
Moving Average (lt_ma)
« on: 20 Jul 2021, 14:29 »
Good Afternoon 

Can someone suggest a way of implementing lt_ma into the price field but making the value valid so rounding the number up in each instance to the nearest tick; 
i.e - 5.55 to 5.6 
2.024 to 2.04 
1.778 to 1.8 etc

Your advice will be most appreciated. 

Regards 

  • All members
  • Posts: 33
  • Karma: +7/-0
  • Gender: Male
Re: Moving Average (lt_ma)
« Reply #1 on: 20 Jul 2021, 16:54 »
INTEGER(lt_ma) would probably get you most of the way there, but will probably round down.

r_ticks(INTEGER(lt_ma),1) will round up, but might add an 'extra' tick depending on the price.

If the rounding goes both ways depending on lt_ma then conditionals should cover it (not sure I've written this correctly, but something like):

IF(INTEGER(lt_ma) < r_ticks(INTEGER(lt_ma),1), r_ticks(INTEGER(lt_ma),1), INTEGER(lt_ma))

  • All members
  • Posts: 5
  • Karma: +0/-0
  • Gender: Male
Re: Moving Average (lt_ma)
« Reply #2 on: 21 Jul 2021, 09:49 »
Hi


Unfortunately this rounds down to the nearest whole number + or - 1 tick. I need it to round down to the nearest tick. In this instance it is rounding down from 3.95 to 3.00 + 1 tick = 3.05. Or less 1 tick 2.98. thanks for the suggestion but anyone have a solution? 

  • Moderator
  • Posts: 3353
  • Karma: +278/-0
*
Re: Moving Average (lt_ma)
« Reply #3 on: 21 Jul 2021, 15:07 »
Hi
Have you tried: r_ticks(lt_ma, 0)
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.