Camarilla Forex System-Daily1
Download scriptThe Camarilla Forex System-Daily is an automated calculation tool designed for traders who utilize the Camarilla Pivot Point strategy. This specific script functions as a high-precision data processor that identifies key price levels—specifically the H1, L1, H3, L3, H4, and L4 levels—based on the previous day's market activity.
How the Logic Works
The script operates by analyzing the price action of the preceding completed trading day to establish significant support and resistance boundaries for the current day. Here is a breakdown of its internal logic:
1. Environment Validation Before performing any calculations, the system performs three essential checks to ensure accuracy:
- Timeframe Verification: It confirms that the chart is set to the Daily (D1) timeframe. If used on other intervals (like 1-hour or 15-minute), the script will notify the user that it is not intended for those views.
- Date Constraint: It ensures the account is viewing data from the year 2006 onwards to maintain compatibility with its mathematical models.
- Execution Interval: It includes a safety buffer (a 5-second delay) to prevent the script from running multiple times simultaneously, ensuring stability in calculations.
2. Mathematical Calculation The core of the script relies on the "Range" (Q) of the previous day—the difference between that day's highest and lowest prices. Using this range, the script applies specific coefficients to the previous day's closing price to derive seven distinct variables:
- H4 & L4: Represent the extreme boundaries of the trading range.
- H3 & L3: Identify deeper support and resistance levels within the day's range.
- H1 & L1: Act as the immediate "breakout" or "reversal" zones near the closing price.
3. Data Persistence Instead of simply displaying these numbers on the screen, the script uses a "Global Variable" method. This means it saves the calculated levels into the platform's permanent memory for the specific currency pair being viewed. This allows the values to remain consistent and accessible as data points for the trading session, providing a reliable framework for identifying where price might react or reverse throughout the day.
/*-----------------------------+
| |
| Shared by www.Aptrafx.com |
| |
+------------------------------*/
#include <stdlib.mqh>
//+------------------------------------------------------------------+
//| Camarilla Forex System-Daily.mq4 |
//| |
//| |
//| Converted by Mql2Mq4 v1.1 |
//| http://yousky.free.fr |
//| Copyright © 2006, Yousky Soft |
//+------------------------------------------------------------------+
#property copyright " Copyright © 2005 FAB4x, Alejandro Galindo & KillerKhan"
#property link ""
//+------------------------------------------------------------------+
//| Common External variables |
//+------------------------------------------------------------------+
extern double Lots = 1.00;
extern double StopLoss = 0.00;
extern double TakeProfit = 0.00;
extern double TrailingStop = 0.00;
//+------------------------------------------------------------------+
//| External variables |
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//| Special Convertion Functions |
//+------------------------------------------------------------------+
int LastTradeTime;
//+------------------------------------------------------------------+
//| End |
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//| Initialization |
//+------------------------------------------------------------------+
int init()
{
return(0);
}
int start()
{
//+------------------------------------------------------------------+
//| Local variables |
//+------------------------------------------------------------------+
double Q = 0;
double H4 = 0;
double H3 = 0;
double L4 = 0;
double L3 = 0;
double L1 = 0;
double H1 = 0;
string vQ = "";
string vH4 = "";
string vH3 = "";
string vL4 = "";
string vL3 = "";
string vL1 = "";
string vH1 = "";
//+-------------------------------------------------------------------+
//| Made/Modified by Alejandro Galindo |
//| |
//| If this work/modification is helpful to you |
//| send me a PayPal donation to ag@elcactus.com |
//| any help is apreciated :) |
//| Thanks. |
//+-------------------------------------------------------------------+
/*[[
Name := CAMARILLA SYSTEM DAILY
Author := Copyright © 2005 FAB4x, Alejandro Galindo & KillerKhan
Lots := 1.00
Stop Loss := 0
Take Profit := 0
Trailing Stop := 0
]]*/
if( Period() != 1440 )
{
Comment("This expert is for Daily Charts Only!!!");
return(0);
}
if( TimeYear(Time[0])<2006 ) return(0);
if( CurTime() - LastTradeTime < 5 ) return(0);
Q=(High[1]-Low[1]);
H4 =(Q*0.55)+Close[1];
H3 =(Q*0.27)+Close[1];
L3 =Close[1]-(Q*0.27);
L4 =Close[1]-(Q*0.55);
L1 =Close[1]-(Q*0.09);
H1 =(Q*0.09)+Close[1];
vQ = "[" + Symbol() + "] Q";
vH4 = "[" + Symbol() + "] H4";
vH3 = "[" + Symbol() + "] H3";
vL3 = "[" + Symbol() + "] L3";
vL4 = "[" + Symbol() + "] L4";
vL1 = "[" + Symbol() + "] L1";
vH1 = "[" + Symbol() + "] H1";
GlobalVariableSet(vQ,Q);
GlobalVariableSet(vH4,H4);
GlobalVariableSet(vH3,H3);
GlobalVariableSet(vL4,L4);
GlobalVariableSet(vL3,L3);
GlobalVariableSet(vL1,L1);
GlobalVariableSet(vH1,H1);
return(0); return(0);
}
Comments