Velocity, Acceleration and Momentum

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #165495 quote
    Khaled
    Participant
    Veteran

    Hello everyone,

    I’ve been looking for filter to avoid false signals and want to submit this idea for improvement and critical thinkingPlease share your thoughts.

    Nothing new, just compiling some physics principles. May be something similar exist already.

    The two basic principales are the Velocity (https://en.wikipedia.org/wiki/Velocity) and the Momentum (https://en.wikipedia.org/wiki/Momentum), applied to price and volume.

    For the price to make a signficant change in a sustainable manner, we need both acceleration in price change with signficant volume.

    The problem I found comparing Intraday Volume to previous bars (Volume > Volume[1]) or to Intraday Average Volume or to volume same time on previous day doesn’t work consistently and may be impacted by Geopolitics, Macro, etc. Further, because of the large volume on the X first bars of the day, most of the volume bars are below the the Intraday Average Volume, so the filter is defeated.

    Velocity = (Indicator – Indicator[1]) / (T – T[1])

    Acceleration = (Velocity – Velocity[1]) / (T – T[1])

    One can apply this idea to Close, MedianPrice, Averages, etc. I chose Hull Average in the exemple below because its one of the most sensitive.

    Then, to move the price in a sustainable manner => Momentum = Mass * Velocity.

    I chose to define Mass as (MedianPrice * Volume) “Mass of Money”.

    For Long, if Acceleration (change is Velocity) is higher than its EMA and Momentum is positive and higher than its EMA, then if your Indicator(s), say Moving Average crossing or Stochastics, etc., give a Signal, there is a high probability that it’s not a false signal and you can enter the trade with more assurance. (the opposite for Shorts)

    When you’re already in position, this might be used as Exit Signal in the opposite direction.

    Please share your thoughts!

    DEFPARAM CALCULATEONLASTBARS=500
    
    Period = 1
    
    PRICE = MEDIANPRICE
    Mass1  = (PRICE * VOLUME)
    
    av1 = HullAverage[13](close)
    av2 = HullAverage[34](close)
    
    Velocity1Av1 = (av1 - av1[Period])/Period
    Velocity0Av1 = (av1[1] - av1[Period+1])/Period
    Acceleration1Avg1 = (Velocity1Av1 - Velocity0Av1) / Period
    EMAAcceleration1 = ExponentialAverage[8](Acceleration1Avg1)
    
    Momentum1 = Mass1 * Velocity1Av1
    EMAMomentum1 = ExponentialAverage[8](Momentum1)
    
    Velocity1Av2 = (av2 - av2[Period])/Period
    Velocity0Av2 = (av2[1] - av2[Period+1])/Period
    Acceleration1Avg2 = (Velocity1Av2 - Velocity0Av2) / Period
    EMAAcceleration2 = ExponentialAverage[8](Acceleration1Avg2)
    
    
    IF Acceleration1Avg1 > EMAAcceleration1 and Acceleration1Avg1 > Acceleration1Avg2 and Momentum1 > 0 and Momentum1 > EMAMomentum1 THEN
    DRAWARROWUP(barindex, -1.5) coloured(0,255,0)
    ENDIF
    
    IF Acceleration1Avg1 < EMAAcceleration1 and Acceleration1Avg1 < Acceleration1Avg2 and Momentum1 < 0 and Momentum1 < EMAMomentum1 THEN
    DRAWARROWDOWN(barindex, 1.5) coloured(255,0,0)
    ENDIF
    
    RETURN +2, -2
    Nicolas, PLermite and Monochrome thanked this post
    #165497 quote
    Khaled
    Participant
    Veteran

    @GraHal @Nicolas @robertogozzi @Monochrome @Vonasi

    Appreciate your thoughts on the above. Thanks

    #165501 quote
    robertogozzi
    Moderator
    Master

    It’s a very nice and useful idea.

    Thanks for sharing with us! 🙂

    When drawing arrows I suggest that you use a more portable code. Instead of +1.5 and -1.5 you could use:

    (high + (range * 1.5))
    (low  - (range * 1.5))

    what use is RETURN +2, -2 ?

    Khaled thanked this post
    #165503 quote
    Khaled
    Participant
    Veteran

    Thank you Roberto. As my programming skills are average, I use “+2, -2” to have the arrows, placed at “+1.5, -1.5”, visible… it’s that simple 🙂 I’ll use your suggestion ((high + (range * 1.5)))

    #219891 quote
    n_nwosu
    Participant
    New

    Hi Guys, I am not able to use this code. It appears to have some errors on it. Is anyone able to remove the errors on this code and post a working one. Thank you in advance. Regards

    #219956 quote
    robertogozzi
    Moderator
    Master

    It’s due to lines 5 and 6, where the variable PRICE is defined and used. It is now a RESERVED keyword (which wasn’t back then), so you should replace PRICE with myPRICE, like that:

    myPRICE = MEDIANPRICE
    Mass1  = (myPRICE * VOLUME)
    PeterSt thanked this post
Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.

Velocity, Acceleration and Momentum


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
Khaled @khaled Participant
Summary

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

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 03/27/2021
Status: Active
Attachments: 1 files
Logo Logo
Loading...