Looking for a correct script/indicator designed to measure the movement of pips on a 15-minute chart after a red news event, 15 minutes (a candle) after red news.
I tried using ChatGPT to create a script to help calculate pip movements after Red News, but so far, it hasn't been successful. In the case of GBPJPY on the M15 chart, I manually calculated the movement after the BOJ Policy Rate and Monetary Policy Statement events, and the pips moved positively by 289.x points, while the script only showed a value of 199.x points.
Thanks for your help.
I tried using ChatGPT to create a script to help calculate pip movements after Red News, but so far, it hasn't been successful. In the case of GBPJPY on the M15 chart, I manually calculated the movement after the BOJ Policy Rate and Monetary Policy Statement events, and the pips moved positively by 289.x points, while the script only showed a value of 199.x points.
Thanks for your help.
Inserted Code
//+------------------------------------------------------------------+
//| Script to Measure Pip Movement After Red News in MT4 |
//+------------------------------------------------------------------+
#property copyright "RoelsMajor ChatGPT"
#property description "Script to Measure Pip Movement After Red News in MT4"
#property strict
#property show_inputs
// Input for the news event time
input datetime NewsEventTime = D'2024.12.19 08:15:00'; // Input Red News Time
// Main Function
void OnStart()
{
// Define variables
datetime startTime = NewsEventTime;
datetime endTime = startTime + 900; // 15 minutes = 900 seconds
double highPrice = 0.0, lowPrice = 0.0;
// Get the candle index for the news event time
int newsCandle = iBarShift(NULL, PERIOD_M15, startTime, false);
if (newsCandle < 0)
{
Print("Error: Unable to find the candle for the specified time.");
return;
}
// Get the range (high/low) of the candle immediately following the news
highPrice = iHigh(NULL, PERIOD_M15, newsCandle);
lowPrice = iLow(NULL, PERIOD_M15, newsCandle);
// Error handling: Check if values were retrieved
if (highPrice == 0 || lowPrice == 0)
{
Print("Error: Invalid high/low values. Check your data.");
return;
}
// Calculate pip movement
double pipMovement = (highPrice - lowPrice) / Point;
// Display results
string message = "Pip Movement After News:\n";
message += "High Price: " + DoubleToString(highPrice, Digits) + "\n";
message += "Low Price: " + DoubleToString(lowPrice, Digits) + "\n";
message += "Pip Movement: " + DoubleToString(pipMovement, 1) + " pips";
// Output the results
Print(message);
Alert(message);
} Attached File(s)
fooled by randomness in art
Meditation All Time Return:
8.9%