OmniTrader Professional Forum OmniTrader Professional Forum
forums calendars search
today this week
 
register logon control panel Forum Rules
You are currently browsing as a guest.
You should logon to access more features
A Self-Moderated Community - ALL MEMBERS, PLEASE READ!
Vote for Members who contribute the most to your trading, and help us moderate content within the Forums.


Only Forum Moderators, Administrators, and the owner of this message may delete it.

 
Etherist

Member
25
Posts: 25

Joined: 6/9/2024
Location: South Australia

User Profile
 
Subject : RE: impulseMACD
Posted : 6/10/2024 4:08 AM
Post #32433 - In reply to #32413

Accessing the components of the impulse MACD (iMACD), can be achieved within OmniTrader using OmniScript.

Accessing iMACD Components in OmniTrader:

To access the trigger line, signal line, and histogram of the impulse MACD with parameters (34,9), you can use OmniScript to calculate and plot these values.

OmniScript Example:

==================================================================

' Define parameters for the iMACD
Dim FastLength As Integer
Dim SlowLength As Integer
Dim SignalSmoothing As Integer

FastLength = 34
SlowLength = 9
SignalSmoothing = 9

' Calculate the MACD line and Signal line
Dim MACDLine As Series
Dim SignalLine As Series
Dim Histogram As Series

MACDLine = MACD(Close, FastLength, SlowLength) ' MACD line using close prices
SignalLine = Signal(MACDLine, SignalSmoothing) ' Signal line (EMA of MACD line)

' Calculate the Histogram as the difference between MACD line and Signal line
Histogram = MACDLine - SignalLine

' Plot the iMACD components
Plot1(MACDLine, "MACD Line", ColorBlue)
Plot2(SignalLine, "Signal Line", ColorRed)
Plot3(Histogram, "Histogram", ColorGreen)

' Optionally, you can add logic for trading signals based on the iMACD
If CrossOver(MACDLine, SignalLine) Then
Buy("Buy Signal")
ElseIf CrossUnder(MACDLine, SignalLine) Then
Sell("Sell Signal")
End If

===================================================================

Explanation

1. Define Parameters:
- `FastLength`: The fast period length for the MACD.
- `SlowLength`: The slow period length for the MACD.
- `SignalSmoothing`: The period length for the signal line.

2. Calculate MACD Line and Signal Line:
- `MACDLine`: Calculated using the `MACD` function with the `Close` price and specified fast and slow lengths.
- `SignalLine`: Calculated as the EMA of the `MACDLine` over the `SignalSmoothing` period.

3. Calculate Histogram:
- `Histogram`: The difference between the `MACDLine` and the `SignalLine`.

4. Plot the Components:
- `Plot1`: Plots the `MACDLine` in blue.
- `Plot2`: Plots the `SignalLine` in red.
- `Plot3`: Plots the `Histogram` in green.

5. Trading Logic (Optional):
- Includes basic trading signals for crossover events between the `MACDLine` and the `SignalLine`.

Customisation and Use:

- Customisation: Adjust the `FastLength`, `SlowLength`, and `SignalSmoothing` parameters to fit your specific needs.
- Use: Implement this script within OmniTrader to plot and potentially use the iMACD components for your trading strategy.
Deleting message 32433 : RE: impulseMACD


Nirvana Systems
For any problems or issues please contact our Webmaster at webmaster@nirvsys.com.