// Define variables for monthly O, H, L, C
MonthlyOpen = TimeFrameGetPrice("O", inMonthly, -1); // Previous month's Open (using -1 shift to avoid looking into the future on partial bars)
MonthlyClose = TimeFrameGetPrice("C", inMonthly, -1); // Previous month's Close
Monthly2Open = TimeFrameGetPrice("O", inMonthly, -2); // Previous month's Open (using -1 shift to avoid looking into the future on partial bars)
Monthly2Close = TimeFrameGetPrice("C", inMonthly, -2); // Previous month's Close
// Get current week's close for reference
WeeklyClose = Close;
// Determine monthly trend status
// A simple bullish condition: previous monthly close > previous monthly open
// A simple bearish condition: previous monthly close < previous monthly open
// Note: More sophisticated trend definitions (e.g., using moving averages) can be used.
// Condition check (for previous complete month)
IsMonthlyBullish = MonthlyClose > MonthlyOpen;
IsMonthlyBearish = MonthlyClose < MonthlyOpen;
IsMonthly2Bullish = Monthly2Close > Monthly2Open;
IsMonthly2Bearish = Monthly2Close < Monthly2Open;
// Status text for exploration column
MonthlyStatus = WriteIf(IsMonthlyBullish, "Bullish", WriteIf(IsMonthlyBearish, "Bearish", "Neutral/N/A"));
Monthly2Status = WriteIf(IsMonthly2Bullish, "Bullish", WriteIf(IsMonthly2Bearish, "Bearish", "Neutral/N/A"));
// Exploration output
if (Status("action") == actionExplore)
{
Filter = 1; // Show all stocks in the exploration
AddColumn(WeeklyClose, "Weekly Close", 1.2);
//AddColumn(MonthlyOpen, "Prev Monthly Open", 1.2);
//A/ddColumn(MonthlyClose, "Prev Monthly Close", 1.2);
//AddColumn(Monthly2Open, "Prev Monthly Open", 1.2);
//AddColumn(Monthly2Close, "Prev Monthly Close", 1.2);
AddTextColumn(MonthlyStatus, "Month-1 Status", 1.0, colorDefault, IIf(IsMonthlyBullish, colorGreen, IIf(IsMonthlyBearish, colorRed, colorDefault)));
AddTextColumn(Monthly2Status, "Month-2 Status", 1.0, colorDefault, IIf(IsMonthly2Bullish, colorGreen, IIf(IsMonthly2Bearish, colorRed, colorDefault)));
}
Using this I'm running exploration in weekly mode but the results are different on different stocks, some are showing correct results some are showing mismatch, why it is happening, any body please suggest. Please see the attached image, last month is ongoing month, previous two months are bearish on chart but exploration is showing differently.
Thanks.
