Australian (ASX) Stock Market Forum

Joined
22 February 2022
Posts
7
Reactions
5
I am trying to create a chart on exploration showing the frequency distribution of a particular array. For example, I have an array(dbar) containing the barcount of each trades drawdown and i want to see the frequency distribution of it:

// This example shows the array for long positions only //

drawdown = LLV(L, Barssince(Buy) - 1);
hasdrawdown = drawdown < BuyPrice;
tbar = Barssince(Buy) - Barssince(drawdown == L);
dbar = 0;

for(i = 0; i < barcount; i++)
{
if(Sell and hasdrawdown)
dbar = tbar;
}

I've been searching online everywhere and can't seem to find a solution. Help would really be appreciated.
 
I am trying to create a chart on exploration showing the frequency distribution of a particular array. For example, I have an array(dbar) containing the barcount of each trades drawdown and i want to see the frequency distribution of it:

// This example shows the array for long positions only //

drawdown = LLV(L, Barssince(Buy) - 1);
hasdrawdown = drawdown < BuyPrice;
tbar = Barssince(Buy) - Barssince(drawdown == L);
dbar = 0;

for(i = 0; i < barcount; i++)
{
if(Sell and hasdrawdown)
dbar = tbar;
}


I've been searching online everywhere and can't seem to find a solution. Help would really be appreciated.
just wanted to say, not ignoring your question but unable to answer.....Sorry, not an area I play a lot with under AB
 
This code will calculate the 12-period SMA for the close prices of the past 12 months, and then compare the current close price to the SMA. If the current close price is above the SMA, the chart will be colored green. If the current close price is below the SMA, the chart will be colored red. If the current close price is equal to the SMA, the chart will not be colored. Not sytax checked yet.

// This function is called every time a new bar is added to the chart function OnData(data) { // Get the close prices for the past 12 months closePrices = data.GetClose(); // Calculate the 12-period SMA sma = SMA(closePrices, 12); // Get the current close price currentClose = closePrices[closePrices.Length - 1]; // If the current close price is above the 12-period SMA, color the chart green if (currentClose > sma[sma.Length - 1]) { ChartSetBgColor(RGB(0, 255, 0)); } // If the current close price is below the 12-period SMA, color the chart red else if (currentClose < sma[sma.Length - 1]) { ChartSetBgColor(RGB(255, 0, 0)); } // If the current close price is equal to the 12-period SMA, do not change the chart color else { ChartSetBgColor(RGB(255, 255, 255)); } }
 
Here is an example of how you can create a trading system in Amibroker that uses machine learning algorithms to identify patterns and make trades based on the patterns it detects:

// This function is called every time a new bar is added to the chart function OnData(data) { // Get the close prices for the past 50 bars closePrices = data.GetClose(50); // Use machine learning algorithms to identify patterns in the close prices patterns = IdentifyPatterns(closePrices); // If a bullish pattern is detected, buy the stock if (patterns == "Bullish") { Buy("BUY"); } // If a bearish pattern is detected, sell the stock else if (patterns == "Bearish") { Sell("SELL"); } } // This function uses machine learning algorithms to identify patterns in the close prices function IdentifyPatterns(closePrices) { // Use machine learning algorithms to analyze the close prices and identify patterns patterns = AnalyzeWithML(closePrices); // Return the identified patterns return patterns; }

This code uses the IdentifyPatterns function to analyze the close prices for the past 50 bars using machine learning algorithms, and then identifies patterns in the data. If a bullish pattern is detected, the code executes a buy order. If a bearish pattern is detected, the code executes a sell order.

Keep in mind that this is just an example of how machine learning could be used in a trading system, and there are many different ways to implement machine learning in Amibroker. Not syntax checked.
 
Top