Click here to Login





                                                   Timeframe Script

  0

0
Seeker
2022-05-24 02:27:37


This is the script for changing the timeframe of the active chart (this one changes timeframe to weekly)

Chart c = Charts.GetSelectedChart();
c.TimeFrame = 7;
c.IsHistorical = true;

I am looking for some help/hint to get something like the following:

If the existing Timeframe =1, then TimeFrame() =7
If the existing Timeframe =7, then TimeFrame() =31
If the existing Timeframe = 31 then TimeFrame()=90
Else TimeFrame() =1

Idea is to get one keyboard shortcut to toggle between 4 different timeframes.

Also could anyone manage to code which can shift from linear scale to log scale. I am told by QS that its not possible (may be there is no function available for scaling).





QuantShare
2022-05-26 12:19:11

  0

Best Answer
You can do something like:

if(c.TimeFrame==1)
{
c.TimeFrame = 7;
}
else if(c.TimeFrame==7)
{
c.TimeFrame = 31;
}
else if(c.TimeFrame==31)
{
c.TimeFrame = 90;
}
else
{
c.TimeFrame = 1;
}



Seeker
2022-05-27 01:22:11

  0

Thats brilliant. Any workaround to create a keyboard shortcut to shift from linear to log and back?


QuantShare
2022-05-30 17:22:36

  0

It is not possible to change that dynamically unfortunately.


Seeker
2022-05-31 00:23:31

  0

Pls see if it can be added as a feature in the next version


No more messages
0




Reply:

No html code. URLs turn into links automatically.

Type in the trading objects you want to include: - Add Objects
    To add a trading object in your message, type in the object name, select it and then click on "Add Objects"










    QuantShare

    Trading Items
    Identify Spilts Screener Script
    Multi TimeFrame RSI
    Currency Mgmt v 0.9
    System Metrics v2.0
    Tax Implications for Your Trading System

    How-to Lessons
    How to run a screen or a watchlist from a script
    How to get stocks for a particular index using the global script
    How to execute a script at regular intervals
    How to create a custom trading indicator
    How to add a metric in the trading system simulation report

    Related Forum Threads
    Adding data to database through script
    Script to remove Symbols from an Index
    In a Script is there any way to iterate through a List-of-Symbols...
    Money management script help - Targeted net profit per day
    Help With Daily Data Import Script

    Blog Posts
    QS Trading Software: Global Script
    Charting & Scripts - Manage stock charts using the global script
    How to filter quotes data from high and low price spikes
    Update Chart Layout based on Active Time Frame
    How to build and backtest a robust stock trading system









    QuantShare
    Product
    QuantShare
    Features
    Create an account
    Affiliate Program
    Support
    Contact Us
    Trading Forum
    How-to Lessons
    Manual
    Company
    About Us
    Privacy
    Terms of Use

    Copyright © 2025 QuantShare.com
    Social Media
    Follow us on Facebook
    Twitter Follow us on Twitter
    Google+
    Follow us on Google+
    RSS Trading Items



    Trading financial instruments, including foreign exchange on margin, carries a high level of risk and is not suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to invest in financial instruments or foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose. You should be aware of all the risks associated with trading and seek advice from an independent financial advisor if you have any doubts.