Hi all,
I want to know whether EL have a function that can find the close of a specific bar? for example, i want to refer the close of the bar at 10:00am , and if the close now > the close of 10:00am bar, then buy.
it is just a simple condition using time as a condition, i want even more complex condition that can mark the close of the specific bar, How can i mark it and recall it?
Thanks again!
Refer the close of a specific bar?
- furytrader
- Posts: 354
- Joined: Jul 30 2010
- Location: Chicago, IL
- Has thanked: 155 times
- Been thanked: 217 times
I imagine it would be something like this:
Code: Select all
vars: SpecialClose(0);
If Time = 1000 Then SpecialClose = Close;
If Time > 1000 and C > SpecialClose Then [Insert Trade Logic Here];
- TJ
- Posts: 7774
- Joined: Aug 29 2006
- Location: Global Citizen
- Has thanked: 1036 times
- Been thanked: 2233 times
There are a few background questions you must decide before delving into coding:Hi all,
I want to know whether EL have a function that can find the close of a specific bar? for example, i want to refer the close of the bar at 10:00am , and if the close now > the close of 10:00am bar, then buy.
it is just a simple condition using time as a condition, i want even more complex condition that can mark the close of the specific bar, How can i mark it and recall it?
Thanks again!
1. what is the instrument and chart resolution?
2. is this a recurring time that you need? eg. you want the close price of 10:00am everyday?
or,
3. the time might be variable? say, the time now might be 3pm or it might be 2pm, and you want to know the close at 11:00am or 10:30am?
4. do you need to know the time from previous days? eg. comparing 10am volume with 10am price of yesterday.
Each of the scenario might require a different coding method.
Thanks, it is easy to use time as a condition, but how about i use ES>=+5 (data2, change compare to yesterday close), and mark the bar of close in data1?I imagine it would be something like this:
Code: Select all
vars: SpecialClose(0);
If Time = 1000 Then SpecialClose = Close;
If Time > 1000 and C > SpecialClose Then [Insert Trade Logic Here];
vars: var0(0),specialclose(0);
if time=0415 then close of data2=var0;
if close of data2 - var0>=5 then specialclose=close of data1
however, in the above scripts, the specialclose will change and cannot fixed to the first bar that ES>=+5.
How to mark and fix in the first bar that ES>=+5 of close of data1?
thanks.
- Henry MultiСharts
- Posts: 9165
- Joined: Aug 25 2011
- Has thanked: 1264 times
- Been thanked: 2958 times
The symbol name cannot be compared with such values as time or price.
You need to compare the symbol name with the symbol name, price with price...
You can assign the first close of calculation to the SpecialClose by writing in your script:
You need to compare the symbol name with the symbol name, price with price...
You can assign the first close of calculation to the SpecialClose by writing in your script:
Code: Select all
once SpecialClose = close;
Thanks,The symbol name cannot be compared with such values as time or price.
You need to compare the symbol name with the symbol name, price with price...
You can assign the first close of calculation to the SpecialClose by writing in your script:Code: Select all
once SpecialClose = close;
in order to make it clear what's my aim,
here is the indicator i created, and it is successfully mark the close,
Code: Select all
variables: var0(0),var1(0),var2(0);
if time =0415 then var0=close of data2 else var0=var0[1];
if close of data2-var0 >= 5 then
var2=close of data1;
else var2=0;
if close[1]of data2-var0 >=5 then var2=var2[1];
plot1(var2);
Code: Select all
variables: var0(0),var1(0),var2(0);
if time=0415 then var0=close of data2 else var0=var0[1];
if close of data2-var0>=5 then
var2=close of data1
else var2=0;
if close[1]of data2-var0 >=5 then var2=var2[1];
if var2<>0 then
buy next bar at market;
- Henry MultiСharts
- Posts: 9165
- Joined: Aug 25 2011
- Has thanked: 1264 times
- Been thanked: 2958 times
Please describe what do you mean by "it is not working ".
If you want the signal calculation to match to the indicator calculation-you need to enable Intra bar order generation for the signal.
If you want the signal calculation to match to the indicator calculation-you need to enable Intra bar order generation for the signal.