Attachments forums

List of attachments posted on this forum.


All files on forums: 135977

Re: Beatle's Trend Trading System

dmnik, Mon Dec 25, 2023 6:06 am

Maybe someone can convert this script to MT4!

This script is an indicator that combines the MIDAS (Market Interpretation/Data Analysis System) algorithm with the Volume Weighted Average Price (VWAP). Let's go through its logic step by step:

Definition of the getVwap function:

This function calculates the VWAP for a given time period.
It takes parameters: src (price), length (period), vol (volume).
If length is less than 1, it returns na (undefined value).
Otherwise, it uses a loop to accumulate volume and weighted price.
It returns the VWAP: uwgt / uvol.
Definition of the getMidas function:

This function calls getVwap to calculate VWAP based on high, low, or the average price (hlc3).
It takes parameters: len (period), isHighest (flag indicating whether the highest price is used).
It returns an array of two values: MIDAS based on hlc3 and MIDAS based on high or low price.
Definition of the getMidasTrend function:

This function determines the trend based on the passed values of vtop and vbot.
It returns 1 if the current price is above vtop and close > vbot. It returns -1 if the current price is below vbot and close < vtop. Otherwise, it returns 0.
Definition of Parameters:

md_show: a flag to display information about MIDAS. User input.
ma1_len, ma2_len, ma3_len, ma4_len: periods for calculating MIDAS, user input.
Calculation of MIDAS for Different Periods and Determination of Visibility and Color:

For each period, getMidas and getMidasTrend functions are called.
Visibility (above or below the price range) and color (red or green) for each MIDAS are determined.
Lines and fills are drawn with corresponding colors.
MIDAS Trend:

The trend for each period is determined using the getMidasTrend function.
It is used for further analysis and display.
The overall idea is to visually represent various MIDAS levels along with VWAP on the price chart, highlighting areas with different colors depending on their height and position relative to the current price.
All files in topic