chatgpt indicator that looks for arrows on chart and give backtest on how many time bars of arrows match the arrow
Posted: Fri Jul 07, 2023 3:16 am
so i tried to create an indicator using chatgpt with a simple idea of a dashboard that calculates all arrows on chart (from any arrow based indicator) and give backtest result on how many time down arrows bars went down (calculation on same arrow bar ) and same goes for up arrows ,, i got no errors in metaeditor but the indicator doesnt appear or do anything when droped on chart even that the chart already has arrows . help ?
Code: Select all
#property indicator_chart_window
int downArrowCount = 0;
int upArrowCount = 0;
int OnCalculate(const int rates_total, const int prev_calculated, const datetime &time[], const double &open[], const double &high[], const double &low[], const double &close[], const long &tick_volume[], const long &volume[], const int &spread[])
{
for (int i = prev_calculated; i < rates_total; i++)
{
// Check for down arrow and downward close
if (low[i] < low[i - 1] && close[i] < close[i - 1])
{
downArrowCount++;
}
// Check for up arrow and upward close
else if (high[i] > high[i - 1] && close[i] > close[i - 1])
{
upArrowCount++;
}
}
// Update the dashboard or print the values
// You can use the Chart functions or print to the Experts tab in the Terminal window
// Example: ChartIndicatorAdd(0, downArrowCount);
// Example: ChartIndicatorAdd(1, upArrowCount);
// Example: Print("Down Arrow Count: ", downArrowCount, " Up Arrow Count: ", upArrowCount);
return rates_total;
}