[pshaiBot] SuperTrend Stoch-RSI bot (using Bot Framework v2)

0 721 Views No Comments 1 year ago
HTS CLOUDSTABLE
  • Hello you wonderful people!

    Here is the BIGGEST release I have ever made… Let me introduce you to the Bot Framework: the middle-ground between Managed and Unmanaged bot creation.

    The strategy implemented using the framework: https://youtu.be/HpNZ2VpZzSE

    Unfortunately I haven’t yet written a proper manual for bot’s functions and you only get this one example bot you see below in this post.
    I will be writing and updating the manual here once I have got it written! Meanwhile, you can read about the usable functions below.

    
        -- position info
            GetPos( isLong ) : returns the position container (long if true, short if false)
            PosAEP( isLong ) : returns position average entry price
            PosROI( isLong ) : returns position ROI %
            PosAmount( isLong ) : returns position amount
            PosProfit( isLong ) : returns position profit
    
        -- bots inner memory
            SaveValue( key, value ) : save and store a value, similarly to Save() command, but it will be stored inside the bot itself
            LoadValue( key, default ) : returns saved value from bots memory storage or default
    
        -- modules
            AddModule( mod_obj, priority ) : add module object into bot. priority determines what is executed first. priority 1 executes before priority 2 etc
            GetModule( mod_name) : get module by name
    
        -- signals
            SetSignalMode( signalMode ) : sets the bots current signal mode (see <code>signalModules</code>)
            AddSignal( signal ) : adds a signal from a module to the bot. must be called inside modules <code>calculate</code> function
            GetSignal( module_name ) : gets the signal set by another module. NOTE: the module signal is fetched from must have executed before this is called, otherwise signal is SignalNone
    
        -- trading
            IsLongEnabled() : true/false if longs are enabled
            IsShortEnabled() : true/false if shorts are enabled
            EnableLongs() : enable long entries
            EnableShorts() : enable short entries
            DisableLongs() : disable long entries
            DisableShorts() : disable short entries
            GoLong { price, amount, type, note, timeout, custom_index } : place long or buy order
            GoShort { price, amount, type, note, timeout, custom_index } : place short or sell order
            ExitLong { price, amount, type, note, timeout, custom_index } : place exit long or sell order
            ExitShort { price, amount, type, note, timeout, custom_index } : place exit short or buy order
            
        -- orders
            GetOrders( isLong, isExit ) : gets long/short entry/exit orders
            Cancel( index, isLong, isExit ) : cancels an open order based on index and parameters
            CancelAllEntries( isLong ) : cancel all entry orders for long/short side
            CancelAllExits( isLong ) : cancel all exit orders for long/short side
            CancelAllPosition( isLong ) : cancel all entries and exits for long/short side
    
        -- plotting and logging
            PlotLine( chartId, name, value, options/color ) : same as Plot() but will also log the info in live bots
            Print(msg [, color]) : prints a log message, also takes currently running module into account and uses its name in log messages (instead of SSv3) 
    
        -- main
            Update() : runs the bots inner workings
            UpdateModules() : updates all modules, this is called in bot.Update
            SaveBot() : saves bots information
    
        -- customizable event functions
            OnInit(bot_obj) : is called when bot initializes and starts running, input is the bot itself
    
    • This topic was modified 1 year, 4 months ago by pshai.
    • This topic was modified 1 year, 4 months ago by pshai. Reason: improved trade amount calculation
    • This topic was modified 1 year, 4 months ago by pshai. Reason: fixed trade amount issue in spot markets
    • This topic was modified 1 year, 4 months ago by pshai. Reason: made sure bot only trades 1 position at a time
    • This topic was modified 1 year, 4 months ago by pshai. Reason: forced market orders for entries
    HaasScript Code
    Sign in or Register to download for free
    • #3466
      Katerin
      Basic
      Up
      0
      Down
      ::

      Thank you.Looking forward to manual for bot’s functions

Login or Register to Comment

Unlock your crypto trading potential

Create a free account and enjoy everything we have to offer.

Join for Free