futures io



About performing a calculation only once(MultiCharts)


Discussion in EasyLanguage Programming

Updated
    1. trending_up 280 views
    2. thumb_up 1 thanks given
    3. group 2 followers
    1. forum 5 posts
    2. attach_file 1 attachments




Welcome to futures io: the largest futures trading community on the planet, with well over 150,000 members
  • 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 and simple.

-- Big Mike, Site Administrator

(If you already have an account, login at the top of the page)

 
Search this Thread
 

About performing a calculation only once(MultiCharts)

(login for full post details)
  #1 (permalink)
LW11041104
Tokyo,Sapporo
 
 
Posts: 43 since Jan 2023
Thanks: 2 given, 2 received

Is it possible to make it so that the alerts and calculations are done only once, as they seem to be done every minute?


 
Code
var: maxHighday(high),maxhigh(high);


if date[0] <> date[1] then

begin

       maxHighday = maxhigh   ;           
       maxhigh = high;
      
       end

else begin 
     if high>maxhigh  then
            
            maxhigh =high;
            
            end;   
        
if maxhigh>maxHighday then 
       begin
         
       plot1("high");
       alert("high");
       print(symbol,date,time,maxHighday,maxhigh  );

       end
 
else 
       NoPlot(1);

Attached Thumbnails
Click image for larger version

Name:	2023-05-23 Execution Result.png
Views:	49
Size:	73.0 KB
ID:	332177  
Reply With Quote

Can you help answer these questions
from other members on futures io?
Crude data for Sierra Chart
Sierra Chart
Rival systems and Exegy
Platforms and Indicators
Convert Pine Code to NT8
Platforms and Indicators
How to get Index/Equity Data for NT?
NinjaTrader
Mt5 Tradestation Integration
TradeStation
 
Best Threads (Most Thanked)
in the last 7 days on futures io
Artificial Intelligence (AI) and Chat GPT
28 thanks
New NinjaTrader
27 thanks
Spoo-nalysis ES e-mini futures S&P 500
27 thanks
Is anyone actually making money?
18 thanks
how to avoid chop
6 thanks

 
(login for full post details)
  #2 (permalink)
 ABCTG   is a Vendor
 
 
Posts: 2,401 since Apr 2013
Thanks: 431 given, 1,601 received

LW11041104,

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


LW11041104 View Post
Is it possible to make it so that the alerts and calculations are done only once, as they seem to be done every minute?


 
Code
var: maxHighday(high),maxhigh(high);


if date[0] <> date[1] then

begin

       maxHighday = maxhigh   ;           
       maxhigh = high;
      
       end

else begin 
     if high>maxhigh  then
            
            maxhigh =high;
            
            end;   
        
if maxhigh>maxHighday then 
       begin
         
       plot1("high");
       alert("high");
       print(symbol,date,time,maxHighday,maxhigh  );

       end
 
else 
       NoPlot(1);


Follow me on Twitter Reply With Quote
The following user says Thank You to ABCTG for this post:
 
(login for full post details)
  #3 (permalink)
LW11041104
Tokyo,Sapporo
 
 
Posts: 43 since Jan 2023
Thanks: 2 given, 2 received


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.

Reply With Quote
 
(login for full post details)
  #4 (permalink)
LW11041104
Tokyo,Sapporo
 
 
Posts: 43 since Jan 2023
Thanks: 2 given, 2 received


ABCTG View Post
LW11041104,

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.

 
Code
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?

Reply With Quote
 
(login for full post details)
  #5 (permalink)
 ABCTG   is a Vendor
 
 
Posts: 2,401 since Apr 2013
Thanks: 431 given, 1,601 received

LW11041104,

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 View Post
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.


Follow me on Twitter Reply With Quote
 
(login for full post details)
  #6 (permalink)
LW11041104
Tokyo,Sapporo
 
 
Posts: 43 since Jan 2023
Thanks: 2 given, 2 received


ABCTG View Post
LW11041104,

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.

Reply With Quote


futures io Trading Community Platforms and Indicators EasyLanguage Programming > About performing a calculation only once(MultiCharts)


Last Updated on May 26, 2023



Copyright © 2023 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada), info@futures.io
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts