This script is designed to act as a background monitor for your trading chart, specifically focusing on tracking visual signals like arrows. Instead of executing trades automatically, its primary role is to observe and audit the visual elements present on your screen in real-time.
How it Works
The script operates on a continuous "loop" system. Every four seconds, it wakes up to check if anything has changed on your visible chart area. It is programmed to remain quiet and efficient, only performing its primary tasks when it detects that you have scrolled the chart or shifted your view.
Key Functions
1. Visual Recognition The script scans every object currently drawn on your trading platform (such as lines, shapes, or text). It specifically filters these out to identify only "Arrows." By doing this, it ignores decorative elements and focuses solely on the specific visual indicators used for trade signals.
2. Dynamic Counting Once it identifies the arrows, it creates a digital tally of how many are currently visible. This allows the system to keep an accurate count of active signals on your screen at any given moment.
3. Change Detection The script is intelligent enough to know when to act. It compares the current view of the chart against the previous view. If you haven't moved or changed anything, it remains idle to save processing power. It only triggers its counting logic when it detects a change in the visible bars (for example, if you scroll back in time or zoom out).
4. Real-Time Reporting Throughout this process, the script provides constant feedback. It keeps track of the total number of arrows found and updates the "Visible Bar" index, ensuring that the data it is processing matches exactly what you see on your monitor.
Summary for the User
Think of this script as a digital observer. It constantly watches your chart in the background, specifically counting visual arrow signals whenever you move or update your view, providing a consistent and automated way to monitor the volume of indicators appearing on your screen.
/*-----------------------------+
| |
| Shared by www.Aptrafx.com |
| |
+------------------------------*/
int start()
{
int prev=0;
int prevarrow=0,arrowtotal; // drawn on the chart
int lastvisiblebar; // index of it
int obttl,j,k,handle;
string namearray[],name;
while (1>0) // endless loop, thanks to Sleep()....
{
lastvisiblebar=WindowFirstVisibleBar()-WindowBarsPerChart();
//======= if press F12 then =============================
if(lastvisiblebar != prev)
{
obttl=ObjectsTotal();
arrowtotal=0;
//....... make arrows an Array ...................
for (j=0,k=0; j<obttl; j++)
{
name=ObjectName(j);
Print("name",j," is " + name); //debug. turned out empty
if(ObjectType(name)==OBJ_ARROW) // rule out trendlines, etc.
{
namearray[k]=name;
arrowtotal++;
Print("Object ",k," is " +ObjectType(name));//debug. turned out empty
k++;
}
}
//..............................................
Comment("prevarrow=" +prevarrow +" arrowtotal=" +arrowtotal +" lastvisbar=" +lastvisiblebar); //debug. proved that objects and arrows counting and F12 detecting works great.
//---- if new arrows added then --------------------
// bla bla bla
//-------------------------------------------------
prev=lastvisiblebar;
}
//=====================================================
Sleep(4000);
}
return(0);
}
//+------------------------------------------------------------------+
Comments