0bps

Strategy vault / Breakout

Set Bitcoin Price and Push Notifications Via WeChat Rounded Hundred Break Push

Teaching Strategies: When the price is an integer of 100, WeChat pushes a notification, which outputs an array containing 10 elements. Prefer locking the data in the current range Polling whether the data crosses…

JavaScriptBreakout
Author
FMZ_JH
Complexity
Starter · 68 lines
Parameters
1
Backtest bar
1m · intraday
Tested on
BTC/USDT · spot

Teaching Strategies: When the price is an integer of 100, WeChat pushes a notification, which outputs an array containing 10 elements.

Prefer locking the data in the current range Polling whether the data crosses this range Above this interval is an upward breakthrough. Compare with the previous trigger data. If different, record it. Above this range is a downward breakout, and it should be compared with the data from the previous trigger. If different, record it. Note, there is a 100 range that needs to be added here because they all fall into the bottom integer range. Array Shift Forward Loop

Parameters

NameDefaultWhat it controls
Intervaltrueinterval

Source JavaScript

/*backtest
start: 2020-10-13 00:00:00
end: 2020-10-14 01:00:00
period: 1m
basePeriod: 1m
exchanges: [{"eid":"OKEX","currency":"BTC_USDT"}]
*/
var a=[1,2,3,4,5,6,7,8,9,10]
var ticker= _C(exchange.GetTicker)

function lock(){                                //Lock the current price in which integer range
    P=parseInt(ticker.Last/100)*100
    HP=P+100
    lock_tickLast=ticker.Last
//    Log(P,HP,ticker.Last)
} 

function stack(){
    for(var k=0;k<a.length;k++)
        a[k]=a[k+1]
}    

function onTick(){
    ticker = _C(exchange.GetTicker) 
    var get=parseInt(ticker.Last/100)*100
    if(get>P){
        a[9]=get 
        if(a[8]!=a[9]){
            str=a.toString()
            if(a[9]-a[8]>100)
                Log("Successful upward gap breakthrough",get,ticker.Last,"{",str,"}",'@')
            else                        
                Log("Successful breakthrough upward",get,ticker.Last,"{",str,"}",'@' )
            lock()
            stack()
        }
    } 
    else if(get<P){
        a[9]=get+100
        if(a[9]!=a[8]){
            str=a.toString()
            if(a[8]-a[9]>100)
                Log("Successful downward gap breakthrough",a[9],ticker.Last,"{",str,"}",'@')
            else
                Log("Successfully broke downward",a[9],ticker.Last,"{",str,"}",'@' )
            lock()
            stack()
        }
    }
}

function main(){

    lock()
    a[8]=P
//    var ticker=0
    Log("The program runs and starts pushing",ticker.Last,'@')
    
    while(true){ 

            onTick()  

        Sleep(Interval*1000)                      
            
    }    
}

Published by FMZ_JH on the FMZ strategy square · last modified 2020-10-29. Collected in the Quant Trading Vault. Unvalidated research: re-test with your own data and costs before trusting it.

Build this with AgenKit

A spec is not a trading system. Paste this into your coding agent and AgenKit runs a specialist team — architecture, test-first build, risk gates, review — with paper trading on by default.

in Claude Code, Cursor, Codex & 4 more
/agenkit build a production-grade trading bot with a backtest engine, risk controls and paper trading by default from strategies/Set-Bitcoin-Price-and-Push-Notifications-Via-WeChat-Rounded-Hundred-Break-Push.md
  1. npx agenkit install engineering-kit in your project
  2. Paste the command into your agent and approve each phase
  3. Get tests, backtest, risk controls and a paper-trading switch

Understand it first

Before you run this, read the lesson behind the idea and how to backtest it honestly. Specs like this one are the survivors of an unknown number of trials; deflate their results accordingly.

Related specs

esc

Try , , or .

↑↓ move↵ open