Camarilla Pivot ALL bars
Download scriptThis script is designed to automate the visual mapping of specific price zones on a trading chart. Its primary purpose is to identify and plot key price levels based on historical daily data, helping traders visualize potential areas of interest or volatility.
Data Processing and Requirements
Before performing any calculations, the script performs a basic safety check to ensure there is enough historical data available on the chart. If the chart does not contain at least 25 bars of history, the script will pause to prevent calculation errors. Once the requirements are met, the script clears any existing markers from the previous run to ensure the chart remains clean and updated.
The Core Logic: Identifying Price Zones
The script scans through the last 200 historical daily candles. For each of these days, it calculates four distinct price points based on the "range" of that day (the difference between the highest and lowest prices reached).
Instead of just looking at the closing price, the script creates a proportional "buffer" around the previous day's closing price. It uses two specific multipliers to determine these zones:
- High-Side Zones: It calculates two levels above the closing price by taking a percentage of that day’s total price range (specifically 25% and 50%).
- Low-Side Zones: It calculates two corresponding levels below the closing price using the same proportions.
Visual Representation
Once these four levels are calculated for each of the 200 days, the script places four visual markers (arrows) on the chart. Each marker corresponds to a specific historical day and represents one of the identified price zones.
By plotting these points, the tool provides a comprehensive map of "high" and "low" interest zones across a significant period of time. This allows a trader to see where historical price action has clustered or reacted in the past, providing a visual guide for identifying potential support and resistance areas.
//+------------------------------------------------------------------+
//| +
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//#####################################################################
int init()
{
//----
//----
return(0);
}
//#############################################################################
int start()
{
double HiVal,LoVal;
double err,tmp;
double ObjVal;
int cnt;
int Type;
//################################################################################
if(Bars<25){Print("bars less than 100"); return(0); }
//################################################################################
ObjectDelete("CamH4");
ObjectDelete("CamH3");
ObjectDelete("CamL3");
ObjectDelete("CamL4");
for(cnt=0;cnt<200;cnt++)
{
double L3,L4,H3,H4;
H4 =((iHigh(NULL,1440,cnt+1)-iLow(NULL,1440,cnt+1))*(1.1/2))+iClose(NULL,1440,cnt+1);
H3 =((iHigh(NULL,1440,cnt+1)-iLow(NULL,1440,cnt+1))*(1.1/4))+iClose(NULL,1440,cnt+1);
L3 =iClose(NULL,1440,cnt+1)-((iHigh(NULL,1440,cnt+1)-iLow(NULL,1440,cnt+1))*(1.1/4));
L4 =iClose(NULL,1440,cnt+1)-((iHigh(NULL,1440,cnt+1)-iLow(NULL,1440,cnt+1))*(1.1/2));
ObjectCreate("CamH3"+cnt, OBJ_ARROW, 0, Time[cnt],H3);
ObjectSet("CamH3"+cnt,6,White);
ObjectSet("CamH3"+cnt,14,4);
ObjectCreate("CamH4"+cnt, OBJ_ARROW, 0, Time[cnt],H4);
ObjectSet("CamH4"+cnt,6,White);
ObjectSet("CamH4"+cnt,14,4);
ObjectCreate("CamL3"+cnt, OBJ_ARROW, 0, Time[cnt],L3);
ObjectSet("CamL3"+cnt,6,White);
ObjectSet("CamL3"+cnt,14,4);
ObjectCreate("CamL4"+cnt, OBJ_ARROW, 0, Time[cnt],L4);
ObjectSet("CamL4"+cnt,6,White);
ObjectSet("CamL4"+cnt,14,4);
}
//############ End of PROGRAM #########################
return(0);
}
/*
AUDNZD
AUDJPY
AUDCAD
AUDUSD
CADJPY
CHFJPY
EURAUD
EURCAD
EURCHF
EURGBP
EURJPY
EURUSD
GBPJPY
GBPUSD
NZDUSD
USDCAD
USDCHF
USDJPY
USDMXN
GBPCHF
*/
Comments