MOVING AVERAGE NUMERIC VALUE SUBTRACTED

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #136685 quote
    steynpj
    Participant
    Average

    I want to use following as a condition to trade:

    Subtract numeric value of SMA x from SMA y. Trade if result is bigger/smaller than result of same subtraction in previous period.

    Coding/help appreciated.

     

    Thank you.

    #136690 quote
    robertogozzi
    Moderator
    Master

    There you go (bigger):

    x = abs(average[20,0](close) - average[50,0](close))
    If x > x[1] Then
      .
      .
    Endif

    You may want to remove ABS( and the rightmost parenthesis if you want to have both positive and negative values.

    Nicolas thanked this post
    #136771 quote
    steynpj
    Participant
    Average

    Thank you.

    Very helpful.

    Last tweak: What to do if I want to use SMA of mean price of last bar, not close?

    Thank you.

    #136782 quote
    robertogozzi
    Moderator
    Master

    Instead of CLOSE use MedianPrice.

    What do you mean by “SMA of mean price of last bar“?  (The sma of mean price of the last bar is the mean price of last bar itself!)

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.

MOVING AVERAGE NUMERIC VALUE SUBTRACTED


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
steynpj @steynpj Participant
Summary

This topic contains 3 replies,
has 2 voices, and was last updated by robertogozzi
5 years, 8 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 06/21/2020
Status: Active
Attachments: No files
Logo Logo
Loading...