Class4_AUDUSD_not
Download scriptThis script functions as a systematic data generator designed to create a comprehensive log of potential currency pair combinations. Instead of executing live trades or analyzing real-time market movements, the logic focuses on mathematical permutations and systematic recording.
Core Logic Overview
The script performs an exhaustive "brute-force" calculation across five different currency pairs (EURUSD, EURCHF, EURJPY, GBPUSD, and AUDUSD). It systematically cycles through every possible numerical combination for these pairs to identify specific balancing patterns.
Key Procedural Steps:
- Systematic Iteration: The program uses a multi-layered loop system to test a range of values (0, 1, and 2) against each of the five currency pairs. This allows it to explore hundreds of unique combinations in a single execution.
- Buy and Sell Tracking: For every combination generated, the script tracks the accumulation of "Buy" and "Sell" signals based on the numerical values assigned to each pair.
- A value of 0 is categorized as a Buy signal.
- A value of 1 is categorized as a Sell signal.
- Filtering Criteria: The script does not record every combination it finds. It applies specific filters to ensure only relevant data is saved:
- It looks for combinations where the number of Buy signals is nearly equal to the number of Sell signals (either perfectly balanced, or differing by only one).
- It ensures that at least one Buy and at least one Sell signal are present in the set.
- It specifically targets instances where the final currency pair (AUDUSD) maintains a value of 2.
- Data Logging: When a combination meets all the above criteria, the script generates a formatted string containing the total count of Buy/Sell signals, the raw numerical code, and the specific currency labels. This information is then exported into a structured text file for external review.
Final Output
The end result of this script is a structured log file that acts as a reference sheet. It provides a curated list of balanced configurations across five different currencies, organized so that a user can review the mathematical distribution of signals rather than watching live price action.
//+------------------------------------------------------------------+
//| Class1.mq4 |
//| Copyright © 2008, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2008, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"
//+------------------------------------------------------------------+
//| script program start function |
//+------------------------------------------------------------------+
int start()
{
//----
string fn1="Class4_AUDUSD_not.txt";
string s1="";
string cod1="";
int max1=3;
int nrbuy=0;
int nrsell=0;
FileDelete(fn1);
for(int i=0;i<max1;i++)
{
for(int j=0;j<max1;j++)
{
for(int k=0;k<max1;k++)
{
for(int l=0;l<max1;l++)
{
for(int m=0;m<max1;m++)
{
if(i==0) nrbuy++;
if(i==1) nrsell++;
if(j==0) nrbuy++;
if(j==1) nrsell++;
if(k==0) nrbuy++;
if(k==1) nrsell++;
if(l==0) nrbuy++;
if(l==1) nrsell++;
if(m==0) nrbuy++;
if(m==1) nrsell++;
cod1=""+i+""+j+""+k+""+l+""+m;
s1=""+nrbuy+" "+nrsell+" "+i+""+j+""+k+""+l+""+m+" "+i+"-EURUSD "+j+"-EURCHF "+k+"-EURJPY "+l+"-GBPUSD "+m+"-AUDUSD";
if((nrbuy==nrsell) || (nrbuy-1==nrsell) || (nrbuy==nrsell-1))
if((nrbuy!=0))
if((nrsell!=0))
if(m==2)
Write2(fn1,s1);
s1="";
cod1="";
nrbuy=0;
nrsell=0;
}
}
}
}
}
//----
return(0);
}
//+------------------------------------------------------------------+
int Write2(string filename,string str)
{
//Write log file
int handle;
handle = FileOpen(filename,FILE_READ|FILE_WRITE|FILE_CSV,"/t");
FileSeek(handle, 0, SEEK_END);
//FileWrite(handle,"" + TimeToStr(CurTime(),TIME_DATE|TIME_SECONDS) + ": " + str);
FileWrite(handle,str);
FileClose(handle);
//Print(str);
}
Comments