MOVING AVERAGE NUMERIC VALUE SUBTRACTED

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #136685 quote
    steynpjsteynpj
    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
    robertogozzirobertogozzi
    Moderator
    Legend

    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
    steynpjsteynpj
    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
    robertogozzirobertogozzi
    Moderator
    Legend

    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.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

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 robertogozzirobertogozzi
6 years, 3 months ago.

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