Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
About performing a calculation only once(MultiCharts)
your code line "if maxhigh>maxHighday then" remains true, because you do not update the value stored in maxHighday whenever maxhigh is greater than that.
You are correctly updating the value stored in maxhigh whenever high>maxhigh, but you might have missed doing the same for maxHighday when maxhigh>maxHighday.
Adding maxHighday = maxhigh; directly in the line above plot1("high"); should ensure the alert is only fired when there is a new high, but the plot1 would also only appear in this situation.
Yes, the alert was output each time the day's high was greater than the previous day's high and the intraday high was updated.
However, I would like the alert to go off only once when the day's high becomes greater than the previous day's high.
Therefore, I do not want an alert to be sounded each time the intraday high is subsequently renewed.
your code line "if maxhigh>maxHighday then" remains true, because you do not update the value stored in maxHighday whenever maxhigh is greater than that.
You are correctly updating the value stored in maxhigh whenever high>maxhigh, but you might have missed doing the same for maxHighday when maxhigh>maxHighday.
Adding maxHighday = maxhigh; directly in the line above plot1("high"); should ensure the alert is only fired when there is a new high, but the plot1 would also only appear in this situation.
Regards,
ABCTG
The code here is for an indicator that sets the day resolution and sounds an alert only once when the day's high is greater than the previous day's high.
variables:high_1(0),higf_2(0);
high_1=high;
higf_2=high[1];
if high_1>higf_2 then begin
plot1(open,"open");
plot2(high,"high");
plot3(low,"low");
plot4(close,"close");
alert("High");
end
else begin
Noplot(1);
Noplot(2);
Noplot(3);
Noplot(4);
end;
How can I perform the same operation as above with 1 minute resolution?
in that case instead of setting "maxHighday = maxhigh" setting maxHighday to a very large number that is never reached by the market directly in the line above "plot1("high");" should work.
maxHighday = 999999 should usually be enough.
Regards,
ABCTG
LW11041104
Thank you for your response.
Yes, the alert was output each time the day's high was greater than the previous day's high and the intraday high was updated.
However, I would like the alert to go off only once when the day's high becomes greater than the previous day's high.
Therefore, I do not want an alert to be sounded each time the intraday high is subsequently renewed.
in that case instead of setting "maxHighday = maxhigh" setting maxHighday to a very large number that is never reached by the market directly in the line above "plot1("high");" should work.
maxHighday = 999999 should usually be enough.
Regards,
ABCTG
Thank you for your reply.
I replaced maxHighday = 999999 and it seems to have worked.
I may ask for your help again, but I would appreciate it if you could assist me in that case.
var: maxHighday(high),maxhigh(high);
Vars:
MyAlert(true);
if date[0] <> date[1] then
begin
MyAlert = False;
maxHighday = maxhigh ;
maxhigh = high;
end
else
if high>maxhigh then maxhigh =high;
if maxhigh>maxHighday and Not MyAlert then
begin
plot1(High,"high");
If AlertEnabled then alert("high above prior days high: " + GetSymbolName);
MyAlert = True;
print(symbol," Date = ",date," Time = ",Time," maxHighday = ",maxHighday," maxhigh = ",maxhigh );
end;
//else
//NoPlot(1);
var: maxHighday(high),maxhigh(high);
Vars:
MyAlert(true);
if date[0] <> date[1] then
begin
MyAlert = False;
maxHighday = maxhigh ;
maxhigh = high;
end
else
if high>maxhigh then maxhigh =high;
if maxhigh>maxHighday and Not MyAlert then
begin
plot1(High,"high");
If AlertEnabled then alert("high above prior days high: " + GetSymbolName);
MyAlert = True;
print(symbol," Date = ",date," Time = ",Time," maxHighday = ",maxHighday," maxhigh = ",maxhigh );
end;
//else
//NoPlot(1);
Thank you very much for your reply to my question.