LogoLogo
Back to HaasOnline.comSwitch to Trade Platform
3.x
3.x
  • Welcome
  • Getting Started
    • Using Local API Server
    • Authentication
    • Response
      • Error Codes
  • HaasScript
    • Using HaasScript
      • HaasScript Facts
      • Charting
      • Order Handling
      • Interval
      • Input Fields
      • Positions Handling
        • Fee correction
      • Position Information
      • Memory Management
      • Optimizations
      • Signal Handling
      • Trading
    • Script Editor
      • Syntax
      • Parameters
      • Interaction
    • Visual Editor
      • Blocks
      • Parameters
      • Flow Control
      • Interaction
    • Custom Commands
    • Tutorials
      • Trade Bot Guide
        • Creating A Trade Bot
          • Visual Editor Guide
          • Script Editor Guide
          • Custom Containers
        • Customizing Indicators
        • Customizing Safeties
        • Customizing Insurances
        • Creating Easy Indicators
      • Unmanaged Trading Guide
        • Executing Orders
        • Managing Orders
        • Managing Positions
        • Managing Wallet
      • Script Editor
        • Classes
        • MadHatter BBands
        • Percentage Price Change
      • Visual Editor
        • Importing Scripts
        • SmoothRSI
        • Scalper Bot
    • Commands
      • Array Helpers
      • Charting
      • Constants
      • Custom Commands Helpers
      • Easy Indicators
      • Easy Insurances
      • Easy Safeties
      • Equations
      • Flow Control
      • Input Fields
      • Input Settings
      • Mathematical
      • Memory Helpers
      • Miscellaneous
      • Order Handling
      • Order Information
      • Position Information
      • Position Prices
      • Price Data
      • Price Market Information
      • Profit Information
      • Settings
      • Signal Helpers
      • String Helpers
      • Technical Analysis
      • Technical Analysis Helpers
      • Time Information
      • Trade Actions (Managed)
      • Trade Actions (Unmanaged)
      • Trade Bot
      • Trade Market Information
      • Wallet
  • API Endpoints
    • Software API
    • Market Data API
    • Account Data API
    • Trade Data API
    • Advanced Order API
    • Trade Bot API
    • Custom Trade Bot API
    • ENUMS
    • Data Objects
  • Examples
    • Script Bots (C#)
      • Scalper Trade Bot
      • Flash Crash Trade Bot
    • Script Indicators (C#)
      • Indicator Script
      • Technical Analysis Library
    • Pshai Scripts (C#)
      • BBands Ext
      • BBands Ext v2
      • Chaikin A/D Line
      • Calibrator
      • Pshai's RVI
    • Scripted Driver
  • Other Resources
    • YouTube
    • Guides & Tutorials
    • Questions & Answers
    • Community Projects
  • Need Help?
    • Ask on Discord
    • Submit Support Ticket
Powered by GitBook
On this page
  • Creating The Script
  • Calculating The Indicator
  • Creating A Signal
  • Plotting The Indicator
  • Final Script

Was this helpful?

  1. HaasScript
  2. Tutorials
  3. Visual Editor

SmoothRSI

SmoothRSI written in the Visual Editor

PreviousImporting ScriptsNextScalper Bot

Last updated 5 years ago

Was this helpful?

Creating The Script

Calculating The Indicator

First, we are adding a ClosePrices command and attaching the interval to the output of DefineEasyIndicatorsParameters. This will give us price data based on the desired interval.

Next step is adding the RSI and an Input field. Look up RSI in the commands list and attach the prices input to the ClosePrices. Right-click on the period dot of RSI and add Input. Give the command a name relavent to the RSI and a default value.

After we calculated the RSI we can smooth it. We are going to do that with the SMA. Search the command ni the list and attach the RSI output to the prices parameter of SMA. Right-click again on period dot and add an Input. Give it a SMA relevant name.

Creating A Signal

We now have a smoothed RSI as output of the SMA. In order to come to a output we need to check if the value is above or below a certain threshold. We can use the IsBiggerThan and IsSmallerThan command or we can use the GetBuySellLevelSignal. This command will return SignalLong when the value is below the buyLevel and SignalShort when the value is above the sellLevel. We can attach this result to the DefineEasyIndicatorOuput.

The GetBuySellLevelSignal command requires a buy- and sellLevel. Right-click on the dots and add one for both of them. Naming one Overbought and the other Oversold.

Plotting The Indicator

The indicator calculation and signal determination are both finished. We could stop but whats an indicators without a chart? Lets plot the normal and smoothed RSI. Right click on the RSI and SMA output and select Plot. For the chartIndex we will use a small trick. If we start the value with a # the engine will look in our inputs or parameters for a matching value. If we use #chartIndex here, we dont have to draw a line from DefineEasyIndicatorParameters to both Plot commands. Give the normal RSI a darker color. Its less imported and we need to know which is which.

Next are the overbought and oversold lines. We could use 2 PlotHorizontalLines but instead we are using the PlotBuySellZone. This will create a green and red line for the start and end value with a fill in between.

In order to verify our signal is correct, we are going to plot a custom signal bar. Right-click on the output of GetBuySellLevelSignal and add PlotSignalEnum. This will convert and plot a signal on the chart for us. Set the chartIndex on -2. this will plot the signal above the chart.

Save and run the script. Wait for the backtest to finish and have a look at the chart to verify the indicator is working llike it should.

Final Script

If everything is working we remove the PlotSignalEnum command and save the script. We can now use this command in other scripts.