#
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
Home
Forex Forum
+ Add Script
Metastock
Expert Advisors
Explorations
Indicators
Trading Systems
Metatrader
MQL Experts
MQL Indicators
MQ4 Experts
MQ4 Indicators
MQ4 Scripts
Tradestation
Functions
Indicators
PaintBars
ShowMe
Trading Systems
Amibroker
Commentaries
Explorations
Functions
Indicators
Trading Systems
Contact us
Newsletter
Group: Metatrader MQ4 Scripts
Title: Camarilla Pivots
Description:
Camarilla Pivots
//+------------------------------------------------------------------+ //| Camarilla Pivots Script.mq4 | //| Modified for MT4 / MQ4 by Flash52 | //| fxflash52@y... | //+------------------------------------------------------------------+ #property copyright "Modified for MT4 / MQ4 by Flash52" #property link "fxflash52@y..." //+------------------------------------------------------------------+ //| Camarilla Equation Pivots script program start function | //+------------------------------------------------------------------+ int start() { //---- initialize local variables double day_high=0; double day_low=0; double yesterday_high=0; double yesterday_open=0; double yesterday_low=0; double yesterday_close=0; double today_open=0; double ch1=0; double ch2=0; double ch3=0; double ch4=0; double cl1=0; double cl2=0; double cl3=0; double cl4=0; double D1=0.091667; double D2=0.183333; double D3=0.2750; double D4=0.55; double rates_d1[2][6]; //---- exit if period is greater than daily charts if(Period() > 1440) { Print("Error - Chart period is greater than 1 day."); return(-1); // then exit } //---- Get new daily prices & calculate pivots ArrayCopyRates(rates_d1, Symbol(), PERIOD_D1); yesterday_close = rates_d1[1][4]; yesterday_open = rates_d1[1][1]; today_open = rates_d1[0][1]; yesterday_high = rates_d1[1][3]; yesterday_low = rates_d1[1][2]; //---- To display all 8 Camarilla pivots remove comment symbols below and // add the appropriate object functions below // ch1 = ((yesterday_high - yesterday_low) * D1) + yesterday_close; // ch2 = ((yesterday_high - yesterday_low) * D2) + yesterday_close; ch3 = ((yesterday_high - yesterday_low)* D3) + yesterday_close; ch4 = ((yesterday_high - yesterday_low)* D4) + yesterday_close; // cl1 = yesterday_close - ((yesterday_high - yesterday_low)*(D1)); // cl2 = yesterday_close - ((yesterday_high - yesterday_low)*(D2)); cl3 = yesterday_close - ((yesterday_high - yesterday_low)*(D3)); cl4 = yesterday_close - ((yesterday_high - yesterday_low)*(D4)); //---- Set line labels on chart window if(ObjectFind("CH3") != 0) { ObjectCreate("CH3", OBJ_TEXT, 0, Time[35], ch3); ObjectSetText("CH3", "Camarilla H3 ", 8, "Arial", White); } else { ObjectMove("CH3", 0, Time[35], ch3); } if(ObjectFind("CH4") != 0) { ObjectCreate("CH4", OBJ_TEXT, 0, Time[35], ch4); ObjectSetText("CH4", "Camarilla H4 ", 8, "Arial", White); } else { ObjectMove("CH4", 0, Time[35], ch4); } if(ObjectFind("CL3") != 0) { ObjectCreate("CL3", OBJ_TEXT, 0, Time[35], cl3); ObjectSetText("CL3", "Camarilla L3 ", 8, "Arial", White); } else { ObjectMove("CL3", 0, Time[35 ], cl3); } if(ObjectFind("CL4") != 0) { ObjectCreate("CL4", OBJ_TEXT, 0, Time[ 35], cl4); ObjectSetText("CL4", "Camarilla L4 ", 8, "Arial", White); } else { ObjectMove("CL4", 0, Time[35], cl4); } //---- Set lines on chart window if(ObjectFind("CH3line") != 0) { ObjectCreate("CH3line", OBJ_HLINE, 0, Time[40], ch3); ObjectSet("CH3line", OBJPROP_STYLE, STYLE_DOT); ObjectSet("CH3line", OBJPROP_COLOR, Red); } else { ObjectMove("CH3line", 0, Time[40], ch3); } if(ObjectFind("CH4line") != 0) { ObjectCreate("CH4line", OBJ_HLINE, 0, Time[40], ch4); ObjectSet("CH4line", OBJPROP_STYLE, STYLE_DOT); ObjectSet("CH4line", OBJPROP_COLOR, DodgerBlue); } else { ObjectMove("CH4line", 0, Time[40], ch4); } if(ObjectFind("CL3line") != 0) { ObjectCreate("CL3line", OBJ_HLINE, 0, Time[40], cl3); ObjectSet("CL3line", OBJPROP_STYLE, STYLE_DOT); ObjectSet("CL3line", OBJPROP_COLOR, Red); } else { ObjectMove("CL3line", 0, Time[40], cl3); } if(ObjectFind("CL4line") != 0) { ObjectCreate("CL4line", OBJ_HLINE, 0, Time[40], cl4); ObjectSet("CL4line", OBJPROP_STYLE, STYLE_DOT); ObjectSet("CL4line", OBJPROP_COLOR, DodgerBlue); } else { ObjectMove("CL4line", 0, Time[40], cl4); } //---- done return(0); } //+------------------------------------------------------------------+
Author/Source:
Flash52
Forex Directory
|
Free Forex Strategies
|
Forex Trading Systems
|
Privacy
|
Disclaimer
|
Contact