nd1Sig
Download scriptThis tool is designed to identify and visualize specific trend reversals on a trading chart. It functions by analyzing historical price data to pinpoint precise moments where market momentum shifts, marking these transitions with visual signals (arrows) for the user.
Core Logic Overview
The script operates by scanning through a set number of historical bars—determined by the user's settings—to monitor price action. Instead of calculating the movements itself, it acts as an interface that communicates with another specialized technical tool called "BrainTrend1Stop."
How It Works
The logic follows a specific three-step process to determine when to display a signal:
- Data Retrieval: The script looks at the current price candle and compares it to the previous one. It pulls "Stop" data from the underlying BrainTrend1 engine for both timeframes.
- Trend Detection: It specifically looks for "breakout" moments. It monitors whether a trend value has appeared in the current moment but was absent in the previous moment. This allows it to ignore continuous trends and focus only on the exact point of origin.
- Signal Visualization:
- Buy/Upward Signals: When the logic detects a specific upward trend confirmation, it places a visual marker (an arrow) on the chart.
- Sell/Downward Signals: When the logic detects a specific downward trend confirmation, it places a different visual marker on the chart.
User Experience
From a user's perspective, the script simplifies complex trend analysis into clear, actionable visual cues. By filtering out the "noise" of ongoing trends and only highlighting the moments where the trend status changes, it helps traders identify potential entry or exit points more efficiently. The visual output is restricted to the most recent historical data based on the CountBars setting, ensuring the chart remains clean and focused on relevant price action.
//+-----------------------------------------------------------------------+
//| BrainTrend1.mq4 |
//| Copyright © 2005. Alejandro Galindo |
//| http://elCactus.com |
//| ASCTrend1 modified to generate similar signals to BrainTrend1 |
//| Author := C0Rpus - big thanks CHANGE2002, STEPAN and SERSH |
//| Notes := ASCTrend1 3.0 Open Source |
//+-----------------------------------------------------------------------+
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Blue
#property indicator_color2 Red
//---- input parameters
extern int RISK=3;
extern int CountBars=5000;
//---- buffers
double Buffer1[];
double Buffer2[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicator line
IndicatorBuffers(2);
SetIndexStyle(0,DRAW_ARROW,0,1);
SetIndexStyle(1,DRAW_ARROW,0,1);
SetIndexBuffer(0,Buffer1);
SetIndexBuffer(1,Buffer2);
SetIndexArrow(0,108);
SetIndexArrow(1,108);
//----
return(0);
}
//+------------------------------------------------------------------+
//| ASCTrend1 |
//+------------------------------------------------------------------+
int start()
{
int i,shift,counted_bars=IndicatorCounted();
//int Counter,i1,value10,value11;
//double value1,x1,x2;
//double value2,value3;
//double TrueCount,Range,AvgRange,MRO1,MRO2;
double BT1=0, BT2=0, BT3=0, BT4=0;
if (CountBars>=Bars) CountBars=Bars;
SetIndexDrawBegin(0,Bars-CountBars+11+1);
SetIndexDrawBegin(1,Bars-CountBars+11+1);
//---- initial zero
//----
shift=CountBars-11-1;
while(shift>=0)
{
Buffer1[shift]=0;
Buffer2[shift]=0;
BT1=iCustom(NULL,0,"BrainTrend1Stop",10,0,shift);
BT2=iCustom(NULL,0,"BrainTrend1Stop",10,0,shift+1);
BT3=iCustom(NULL,0,"BrainTrend1Stop",10,1,shift);
BT4=iCustom(NULL,0,"BrainTrend1Stop",10,1,shift+1);
if (BT1 && !BT2) { Buffer2[shift]=BT1; }
if (BT3 && !BT4) { Buffer1[shift]=BT3; }
shift--;
}
return(0);
}
//+------------------------------------------------------------------+
Comments