ASCTrend1sig_noSound_001
Download scriptThis script functions as a visual trend-following tool designed to identify specific entry points in the market by analyzing price action and momentum. Rather than simply showing moving averages, it looks for significant shifts in "energy" or volatility to determine when a trend has potentially reversed or exhausted.
Core Logic Overview
The script operates by analyzing the relationship between price movement (how much the candles are moving) and momentum (how fast those movements are occurring). It follows a three-step process:
1. Volatility Assessment First, the tool calculates the average range of recent price bars. It uses this data to establish a "normal" level of volatility. By understanding what a standard move looks like for that specific time period, it can differentiate between regular market noise and significant price shifts.
2. Identifying Key Movements The script then searches for two specific types of movements:
- Gap/Jump Detection: It looks for instances where the price opens significantly further away from its previous close than what is considered normal.
- Velocity Checks: It measures how quickly the price closes over a series of bars to see if there is an accelerating trend.
Based on these findings, the script dynamically adjusts its internal settings to become more or less sensitive. If it detects a high-velocity move, it modifies its calculations to account for that sudden momentum.
3. Signal Generation (The Buy and Sell Arrows) The final part of the logic uses a "momentum percentage" calculation. It looks for specific conditions where:
- Price has moved significantly but is starting to stall or "overextend."
- The price enters a specific "buffer zone" defined by your risk settings.
When these conditions are met, the script places visual markers on your chart:
- Upper Signals: These appear when the momentum suggests a potential downward shift or peak.
- Lower Signals: These appear when the momentum suggests a potential upward shift or trough.
Key User Customization
The logic relies heavily on a Risk parameter. This value acts as a modifier for the "buffer zones." A higher risk value widens the criteria for what constitutes a trend reversal, while a lower value makes the script more sensitive to smaller price fluctuations. The tool essentially filters out the "choppiness" of the market to highlight only those moments where the price is likely making a significant directional change.
//+------------------------------------------------------------------+
//| ASCTrend1sig_noSound.mq4
//| Ramdass - Conversion only
//+------------------------------------------------------------------+
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Blue
#property indicator_color2 Blue
//---- input parameters
extern int RISK=3;//3 as Default
extern int CountBars=1000; //300
//---- buffers
double val1[];
double val2[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicator line
IndicatorBuffers(2);
SetIndexStyle(0,DRAW_ARROW);
SetIndexArrow(0,234); //(0.234)
SetIndexStyle(1,DRAW_ARROW);
SetIndexArrow(1,233); //(1.233) Hercs het verander na Kolletjies 8 November 2005
SetIndexBuffer(0,val1);
SetIndexBuffer(1,val2);
//----
return(0);
}
//+------------------------------------------------------------------+
//| ASCTrend1sig |
//+------------------------------------------------------------------+
int start()
{
if (CountBars>=1000) CountBars=950;
SetIndexDrawBegin(0,Bars-CountBars+11+1);
SetIndexDrawBegin(1,Bars-CountBars+11+1);
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 Table_value2[1000];
value10=3+RISK*2;
x1=67+RISK;
x2=33-RISK;
value11=value10;
//----
if(Bars<=11+1) return(0);
//---- initial zero
if(counted_bars<11+1)
{
for(i=1;i<=0;i++) val1[CountBars-i]=0.0;
for(i=1;i<=0;i++) val2[CountBars-i]=0.0;
}
//----
shift=CountBars-11-1;
while(shift>=0)
{
Counter=shift;
Range=0.0;
AvgRange=0.0;
for (Counter=shift; Counter<=shift+9; Counter++) AvgRange=AvgRange+MathAbs(High[Counter]-Low[Counter]);
Range=AvgRange/10;
Counter=shift;
TrueCount=0;
while (Counter<shift+9 && TrueCount<1)
{if (MathAbs(Open[Counter]-Close[Counter+1])>=Range*2.0) TrueCount=TrueCount+1;
Counter=Counter+1;
}
if (TrueCount>=1) {MRO1=Counter;} else {MRO1=-1;}
Counter=shift;
TrueCount=0;
while (Counter<shift+6 && TrueCount<1)
{if (MathAbs(Close[Counter+3]-Close[Counter])>=Range*4.6) TrueCount=TrueCount+1;
Counter=Counter+1;
}
if (TrueCount>=1) {MRO2=Counter;} else {MRO2=-1;}
if (MRO1>-1) {value11=3;} else {value11=value10;}
if (MRO2>-1) {value11=4;} else {value11=value10;}
value2=100-MathAbs(iWPR(NULL,0,value11,shift)); // PercentR(value11=9)
Table_value2[shift]=value2;
val1[shift]=0;
val2[shift]=0;
value3=0;
if (value2<x2)
{i1=1;
while (Table_value2[shift+i1]>=x2 && Table_value2[shift+i1]<=x1){i1++;}
if (Table_value2[shift+i1]>x1)
{
value3=High[shift]+Range*0.7;
val1[shift]=value3;
}
}
if (value2>x1)
{i1=1;
while (Table_value2[shift+i1]>=x2 && Table_value2[shift+i1]<=x1){i1++;}
if (Table_value2[shift+i1]<x2)
{
value3=Low[shift]-Range*0.7;
val2[shift]=value3;
}
}
shift--;
}
return(0);
}
//+------------------------------------------------------------------+
Comments