ASCT1sig
Download scriptThis script is a specialized technical analysis tool designed to identify specific momentum shifts and trend reversals on a trading chart. It works by analyzing historical price action to determine when the market has moved significantly enough to justify a potential "Buy" or "Sell" signal.
Core Logic Overview
The script evaluates the market by looking at the relationship between recent price volatility and overall momentum. It focuses on three main components:
1. Volatility and Movement Detection The tool first calculates the average size of price bars (the distance between the high and low points) over a small window of time. It then looks for "True Movements"—instances where the price gap between consecutive candles is significantly larger than the average. This helps the script distinguish between normal market noise and meaningful price action.
2. Dynamic Momentum Scoring The script uses a momentum calculation (similar to a Williams %R oscillator) but modifies its sensitivity based on the market's behavior. It checks for two specific conditions:
- Rapid price jumps relative to the average range.
- Significant price shifts over a slightly longer period.
Depending on which of these conditions are met, the script dynamically adjusts its calculation parameters. This allows it to become more or less sensitive based on whether the market is experiencing high-intensity movement or stable trending.
3. Trend Reversal Identification The final step involves tracking how the momentum score evolves over time. The logic looks for specific "breakout" behaviors:
- Sell Signal: If the momentum drops below a certain low threshold and then shows signs of rebounding back into a specific range, the script identifies a potential exhaustion point. It places a signal above the price to alert the user of a possible sell opportunity.
- Buy Signal: Conversely, if the momentum rises above a certain high threshold and shows signs of dropping back into a specific range, it identifies a potential buying opportunity. It places a signal below the price to alert the user.
User Experience and Alerts
The script provides visual feedback directly on the chart by plotting arrows (Magenta for Sell signals and Aqua for Buy signals). Additionally, whenever these conditions are met, the script triggers an automated pop-up alert on the trading platform, notifying the user of the specific currency pair and timeframe where the signal has occurred.
In summary, the tool filters out minor price fluctuations to find significant momentum shifts, alerting the user when the market shows signs of reaching a peak or a valley based on historical volatility.
//+------------------------------------------------------------------+
//| ASCT1sig.mq4
//| Ramdass - Conversion only
//+------------------------------------------------------------------+
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Magenta
#property indicator_color2 Aqua
//---- input parameters
extern int RISK=3;
extern int CountBars=300;
//---- buffers
double val1[];
double val2[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicator line
IndicatorBuffers(2);
SetIndexStyle(0,DRAW_ARROW);
SetIndexArrow(0,108);
SetIndexStyle(1,DRAW_ARROW);
SetIndexArrow(1,108);
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.5;
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.5;
val2[shift]=value3;
}
}
if (val1[shift]>0) Alert(Symbol() + ":" + Period() + " - ASCT SELL");
if (val2[shift]>0) Alert(Symbol() + ":" + Period() + " - ASCT BUY");
shift--;
}
return(0);
}
//+------------------------------------------------------------------+
Comments