I copied this from my earlier posts. Tihs is very close to what I have modified in the last week.
I run this script and works great (again many thanks!)
I also would like to write another script that compares the first 2, 3 bars to the 9:30 bar. So if my chart is set for 9:30 to 1:00 then I want to compare to the 9:30 bar. Can I write that in (exactly that bar I want). So this script will only run for a few bars, and after the third bar is formed (after 9:30 then I really dont want the script to alert me, the conditions are alittle different for the first 3 bars that I track for the day, then the other ones for the rest of the day
9:30 is start bar
9:35 is next bar
9:40 is third bar
after that, I dont want the script to alert me. Confuse yet.
so my statment would be meet this condition
((9:30BarHigh - 9:30BarLow) / 2) > (high(0) - low(0))
Posted EARLIER in another post here
//{{EFSWizard_Declarations
var vLastAlert = -1;
//}}EFSWizard_Declarations
function preMain() {
setComputeOnClose(true);
//{{EFSWizard_PreMain
setPriceStudy(true);
setStudyTitle("");
//}}EFSWizard_PreMain
}
function main() {
setComputeOnClose(true);
var BarTime = rawtime(0);
var BarIndex = (getFirstBarIndexOfDay(BarTime)-getCurrentBarIndex());
var FirstOpen = open(BarIndex);
var FirstHigh = high(BarIndex);
var FirstClose = close(BarIndex);
var FirstLow = low(BarIndex);
//{{EFSWizard_Expressions
//{{EFSWizard_Expression_1
if (
high(0) <= high(-1) &&
close(0) >= open(0) &&
((high(-1) - low(-1)) / 2) > (high(0) - low(0))
) onAction1()
//}}EFSWizard_Expression_1
//{{EFSWizard_Expression_2 AGR1 Type Setup Bar has to be less than 50% of First Bar of day
else if (
high(0) <= high(-1) &&
close(0) >= open(0) &&
((FirstHigh - FirstLow) / 2) > (high(0) - low(0))
) onAction2()
//}}EFSWizard_Expression_2
//}}EFSWizard_Expressions
//{{EFSWizard_Return
return null;
//}}EFSWizard_Return
}
function postMain() {
}
//{{EFSWizard_Actions
//{{EFSWizard_Action_1 Writes AGR to alert trader script has setup
function onAction1() {
drawTextRelative(0, low()-.005, "AGR", Color.RGB(255,255,0), Color.RGB(0,0,0), Text.FRAME, "Arial", 8);
Alert.playSound("C:\Program Files\eSignal\Sounds\l10setup.wav");
vLastAlert = 1;
}
//}}EFSWizard_Action_1
//{{EFSWizard_Action_2 Writes AGR1 to alert trader script has setup
function onAction2() {
drawTextRelative(0, low()-.005, "AGR1", Color.RGB(255,255,0), Color.RGB(0,0,0), Text.FRAME, "Arial", 8);
Alert.playSound("C:\Program Files\eSignal\Sounds\l10setup.wav");
vLastAlert = 2;
I run this script and works great (again many thanks!)
I also would like to write another script that compares the first 2, 3 bars to the 9:30 bar. So if my chart is set for 9:30 to 1:00 then I want to compare to the 9:30 bar. Can I write that in (exactly that bar I want). So this script will only run for a few bars, and after the third bar is formed (after 9:30 then I really dont want the script to alert me, the conditions are alittle different for the first 3 bars that I track for the day, then the other ones for the rest of the day
9:30 is start bar
9:35 is next bar
9:40 is third bar
after that, I dont want the script to alert me. Confuse yet.
so my statment would be meet this condition
((9:30BarHigh - 9:30BarLow) / 2) > (high(0) - low(0))
Posted EARLIER in another post here
//{{EFSWizard_Declarations
var vLastAlert = -1;
//}}EFSWizard_Declarations
function preMain() {
setComputeOnClose(true);
//{{EFSWizard_PreMain
setPriceStudy(true);
setStudyTitle("");
//}}EFSWizard_PreMain
}
function main() {
setComputeOnClose(true);
var BarTime = rawtime(0);
var BarIndex = (getFirstBarIndexOfDay(BarTime)-getCurrentBarIndex());
var FirstOpen = open(BarIndex);
var FirstHigh = high(BarIndex);
var FirstClose = close(BarIndex);
var FirstLow = low(BarIndex);
//{{EFSWizard_Expressions
//{{EFSWizard_Expression_1
if (
high(0) <= high(-1) &&
close(0) >= open(0) &&
((high(-1) - low(-1)) / 2) > (high(0) - low(0))
) onAction1()
//}}EFSWizard_Expression_1
//{{EFSWizard_Expression_2 AGR1 Type Setup Bar has to be less than 50% of First Bar of day
else if (
high(0) <= high(-1) &&
close(0) >= open(0) &&
((FirstHigh - FirstLow) / 2) > (high(0) - low(0))
) onAction2()
//}}EFSWizard_Expression_2
//}}EFSWizard_Expressions
//{{EFSWizard_Return
return null;
//}}EFSWizard_Return
}
function postMain() {
}
//{{EFSWizard_Actions
//{{EFSWizard_Action_1 Writes AGR to alert trader script has setup
function onAction1() {
drawTextRelative(0, low()-.005, "AGR", Color.RGB(255,255,0), Color.RGB(0,0,0), Text.FRAME, "Arial", 8);
Alert.playSound("C:\Program Files\eSignal\Sounds\l10setup.wav");
vLastAlert = 1;
}
//}}EFSWizard_Action_1
//{{EFSWizard_Action_2 Writes AGR1 to alert trader script has setup
function onAction2() {
drawTextRelative(0, low()-.005, "AGR1", Color.RGB(255,255,0), Color.RGB(0,0,0), Text.FRAME, "Arial", 8);
Alert.playSound("C:\Program Files\eSignal\Sounds\l10setup.wav");
vLastAlert = 2;
Comment