NexusFi: Find Your Edge


Home Menu

 





How to use ACS buttons to turn a study on/off


Discussion in Sierra Chart

Updated
      Top Posters
    1. looks_one hendrikus with 2 posts (3 thanks)
    2. looks_two Trembling Hand with 1 posts (0 thanks)
    3. looks_3 Sam McLennan with 1 posts (0 thanks)
    4. looks_4 Quick Summary with 1 posts (0 thanks)
    1. trending_up 2,879 views
    2. thumb_up 3 thanks given
    3. group 5 followers
    1. forum 6 posts
    2. attach_file 0 attachments




 
Search this Thread

How to use ACS buttons to turn a study on/off

  #1 (permalink)
hendrikus
Alkmaar Netherlands
 
Posts: 3 since Dec 2010
Thanks Given: 0
Thanks Received: 1

Hi,

wouldl ike to see if anyone can help me out on the following issue. I am looking to use the ACS buttons in SC in order to turn on a certain study. The following code does not seem to work.
Does anybody have another way of doing this?

Thanks in advance,

FHV

 
Code
SCInputRef Enabled = sc.Input[0]; 
 
 
// wait for an event 
  if (sc.MenuEventID != 0) 
  { 
    if (sc.MenuEventID == SC_ACS_TOOL1) 
    { 
        Enabled.SetYesNo(1); 
    } 
  } 
  else 
  { 
    Enabled.SetYesNo(0); 
  } 
 
  if (!Enabled.GetYesNo()) 
    return; 
 
/// the rest of my study

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Quantum physics & Trading dynamics
The Elite Circle
ZombieSqueeze
Platforms and Indicators
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
What broker to use for trading palladium futures
Commodities
 
  #3 (permalink)
hendrikus
Alkmaar Netherlands
 
Posts: 3 since Dec 2010
Thanks Given: 0
Thanks Received: 1


Figured it out how to do this. Its a nice feature to toggle between strategies. Hope somebody can use it as well.

Goodluck.

FHV

 
Code
if (sc.MenuEventID != 0)  

  {  

    if (sc.MenuEventID == SC_ACS_TOOL1)  

    {  

      if (sc.MouseEventType == SC_ACS_TOOL_ON) 

      { 

        Enabled.SetYesNo(1);  

      } 

      else if (sc.MouseEventType == SC_ACS_TOOL_OFF) 

      { 

        Enabled.SetYesNo(0); 

      } 

    } 

  }   

 

  if (!Enabled.GetYesNo()) 

           return; 

 

// rest of the study 

 

// place an order with brackets when completed 

//.... 

// acs button to off 

  sc.SetACSToolEnable(SC_ACS_TOOL1, false); 

  Enabled.SetYesNo(0);

Reply With Quote
Thanked by:
  #4 (permalink)
 crazybears 
Alesia E.U.
 
Experience: Intermediate
Platform: Sierra chart
Trading: Futures
Posts: 168 since Feb 2011
Thanks Given: 146
Thanks Received: 115

Hi
take a look here :

Advanced Custom Study Interaction With Menus, ToolBar Buttons, Mouse Pointer Events - Sierra Chart

sc.ReceiveMousePointerEvents = 1;

i did 2 buttons , LONG & SHORT , they work only with attached charts

Reply With Quote
  #5 (permalink)
 Traderkysir 
Boston MA/ USA
 
Experience: Beginner
Platform: NinjaTrader
Trading: ZB,YM,NQ
Posts: 1 since Apr 2016
Thanks Given: 3
Thanks Received: 0


crazybears View Post
Hi
take a look here :

Advanced Custom Study Interaction With Menus, ToolBar Buttons, Mouse Pointer Events - Sierra Chart

sc.ReceiveMousePointerEvents = 1;

i did 2 buttons , LONG & SHORT , they work only with attached charts


Hello..
Maybe it's 4 years to late, but would you please share the long/short on/off code.
I'm new to SC/programing and any help will be appreciated
TK

Reply With Quote
  #6 (permalink)
Sam McLennan
New Plymouth
 
Posts: 1 since Aug 2022
Thanks Given: 0
Thanks Received: 0

I'm very interested to know how you created this too please.

Reply With Quote
  #7 (permalink)
 Trembling Hand 
Melbourne, Land of Oz
 
Experience: Advanced
Platform: Sierra Chart, CQG
Broker: CQG
Trading: HSI
Posts: 246 since Jun 2011
Thanks Given: 28
Thanks Received: 360

Using the above code you would replicate that for two buttons, replace the Enabled.SetYesNo(1) with a PersistentInt for long and one for short and toggle that to 1 or 0 then in your trading code use that PersistentInt as a bool flag.

Like this for long trades

 
Code
int& TakeLongs= sc.GetPersistentInt(0);

if (sc.Index == 0)
    TakeLongs = 0;


if (sc.MenuEventID != 0)  
{  
    if (sc.MenuEventID == SC_ACS_TOOL1)  
    {  
      if (sc.MouseEventType == SC_ACS_TOOL_ON) 
      { 
        TakeLongs = 1;  
      } 
      else if (sc.MouseEventType == SC_ACS_TOOL_OFF) 
      { 
        TakeLongs = 0;
      } 

    } 
}   


if (TakeLongs == 1)
{
    // Logic to take long trades
}

Follow me on Twitter Reply With Quote




Last Updated on August 14, 2022


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
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.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts