Not writing for a long time; Although there were several reasons for not writing, it is better not to give excuses, but to give in the guise of originality - it has self-clarity.
Anyway TrickBD has a chain of tutorials on crypto trading and following up should hopefully take you from the basics of crypto trading to the practical execution and earning section – but at the end of CryptoRazz I had something going around in my head like “I won't be trading manually but automatically trading and those trades must be profitable as a single benefit to my crypto portfolio”. Earnings keep piling up”.
Yes…absolutely childish thinking because (1) Crypto market is always uncertain – so guaranteed profit is literally not practical (2) Profitable predictions can only be made by doing proper market analysis and thorough study before taking a trade – there is no alternative.
However, in reverse thinking, if in crypto trading I check the current market condition (legit analysis) with all the crypto trading history (data) in the past and take into account the future condition (future trend) - so that the margin of loss can be reduced to zero even if the probability of profit is minimal - then it is called fairly stable profitable crypto trading. goes
And when all this happens automatically it will be called Automatic Benefited Crypto Trading.
Now the matter is not as simple as it sounds – in the past all the crypto trading market history (data) that can describe each candlestick is possible for a human being to remember and practically utilize as it is almost impossible to verify or compare with the current market condition and taking trades according to the future up trend is also complicated.
In this case, we can create a system rules to verify current market conditions with all crypto trading market history data in the past to execute profitable trades with seemingly zero margin losses – or artificial intelligence (AI) can be used for current market analysis and future trend combination to be as emotionless as possible compared to humans (to avoid unwanted hype trading sessions). (without interruption) can calculate the correct entry point.
On the other hand, it is possible to create a crypto trading automation system that can be active 24/7 from market monitoring – observing trade sessions – opening and closing trades (permission dependent of course).
if (efL != null && esL != null) {
const sp = ((efL - esL) / price) * 100;
tScore = clamp(sp * 40, -100, 100);
}
Analysis: 12-period and 26-period exponential moving average (EMA) calculations.
if (rsiL <= 30) rScore = 100 - (rsiL / 30) * 40; else if (rsiL >= 70) rScore = -(100 - ((100 - rsiL) / 30) * 40);
else rScore = ((50 - rsiL) / 20) * 30;
System Logic: RSI is additional BUY/SELL indicative system function
if (histL != null) {
const dir = histL > 0 ? 1 : histL < 0 ? -1 : 0;
const accel = histP != null ? (histL - histP) : 0;
mScore = clamp(dir * 60 + clamp(accel * 500, -40, 40), -100, 100);
}
System Logic: By looking at the histogram (bar) of MACD we understand the direction and speed of momentum.
if (bU != null && bL != null && bM != null) {
const width = bU - bL || 1;
const posn = (price - bM) / (width / 2);
bScore = clamp(-posn * 70, -100, 100);
}
System Logic: The middle line of Bollinger Bands is a 20 period simple moving average. Where does the current price stand compared to that average?
let w = normWeights(weights);
// Default: trend=30%, rsi=25%, macd=25%, boll=20%
System Logic: By default Trend is weighted at 30%, RSI at 25%, MACD at 25% and Bollinger at 20%.
if (opts.regimeAdaptive && adxL != null) {
const regime = clamp((adxL - 20) / 40, -0.4, 0.4);
const adj = {
trend: w.trend * (1 + regime),
macd: w.macd * (1 + regime),
rsi: w.rsi * (1 - regime),
boll: w.boll * (1 - regime)
};
// Renormalization
}
System Logic: ADX indicator tells whether the crypto market is trending or ranging.
if (opts.volumeConfirm && volRL != null) {
if (volRL >= 1.5) confidence += 8;
else if (volRL <= 0.5) confidence -= 10;
}
System Logic: Not only price analysis but also volume (amount of transactions) is important.
let score = clamp(
tScore * w.trend +
rScore * w.rsi +
mScore * w.macd +
bScore * w.boll,
-100, 100
);
System Logic: The above four scores are added by multiplying them by their adjusted weights. This results in a final score between -100 and +100.
const agreement = same / subs.length;
const magnitude = Math.min(Math.abs(score) / 100, 1);
let confidence = Math.round((0.55 * agreement + 0.45 * magnitude) * 100);
System Logic:
System Logic: Local AI has 20+ analyst roles with each role analyzing the crypto market from a different perspective. Like—Technical Analyst (sees RSI, EMA), Macro Trend Analyst (ADX, sees trend direction), Social Sentiment Scanner (volume type analysis), Risk Analyst (loss potential) etc. After all, all conditions combine to make a decision.
switch (provider) {
case 'openai': // GPT-4o, GPT-4o-mini
case 'deepseek': // DeepSeek-Chat, DeepSeek-Reasoner
case 'gemini': // Gemini 2.0 Flash, Pro
case 'openrouter': // Claude 3.5, Llama 3.2
}
System Logic: You can also use popular AI like OpenAI, DeepSeek, Gemini or OpenRouter to provide intelligence and clarity in the data analysis, compare and decision making section of the crypto market [in this case you can integrate any one desired model or integrate from multiple' model API – or switch any AI model from just OpenRouter].
const blendedConf = Math.round(
(ext.confidence || 50) * 0.6 +
(localResult.confidence || 50) * 0.4
);
System Logic: External AI's opinion is given 60% weight and local council's opinion 40% weight [as the external AI is having the ability to perform current market analysis here] Final decision is taken by combination of both, so that even if one party makes a mistake, the other can correct him and gain the most correct decision.
const riskUsd = equity * (risk.riskPerTrade / 100);
const sizeUsd = Math.min(riskUsd / (stopLossPct / 100), equity * 0.25, paper.cash);
System Logic:
st.paper.openStops[symbol] = {
sl: price * (1 - stopLossPct / 100), // 3% default
tp: price * (1 + takeProfitPct / 100), // 6% default
};
System logic: 3% stop-loss is set below entry price (to cut loss), and 6% take-profit is set above (to book profit).
if (risk.trailingEnabled) {
const gainPct = ((price - avgEntry) / avgEntry) * 100;
if (gainPct >= activatePct) { // Activate at 2% profit
const newSl = price * (1 - trailDistancePct / 100); // 1.5% distance
if (newSl > stops.sl) stops.sl = newSl;
}
}
System logic: If the trade goes to 2% profit, the stop-loss is activated. Then, as the price rises, the stop-loss also moves upwards, maintaining a distance of 1.5%. As a result profit is somewhat secured [however low to gain security of minimum profit].
const dayLoss = ((equity - dayStartEquity) / dayStartEquity) * 100;
if (dayLoss <= -dailyLossLimit) { stop(); }
System Logic: If there is a loss of 5% (default) from the amount of money at the beginning of the trade, then the system understands that the trading day is not going well and automatically shuts down the entire engine.
if (lossLimit > 0 && consecutiveLosses >= lossLimit) {
pausedUntil = Date.now() + (cooldown * 60000);
}
System Logic: If there are 3 trade losses in a row, then the system assumes that it may not understand the market conditions. It stops trading (goes into cooldown) for 60 minutes (default) Next function recall will recheck system data to ensure improved trade execution in synchronization with trading pattern ML.
if (Date.now() - lastAt < cooldownMin * 60000) return; if (label === 'BUY' && holding && holding.qty > 0) return;
if (label === 'SELL' && (!holding || holding.qty <= 0)) return;
System Logic: Before placing a trade the system checks – whether the cooldown (15 minutes) on this pair is over (to avoid repeated trades). If the BUY signal comes, but you already have that coin, don't buy a second time. If the SELL signal comes, but you don't have that coin, don't sell (short selling is not supported).
if (s.risk.multiTfEnabled) {
const hEval = Strategy.evaluate(hCandles, weights, opts);
if (hEval && hEval.label === 'SELL' && label === 'BUY') return;
if (hEval && hEval.label === 'BUY' && label === 'SELL') return;
}
System Logic: Even if the 1 hour chart shows BUY, the system checks the 4 hour or 1 day chart. If the larger timeframe says SELL as opposed to BUY, the smaller timeframe signal is ignored (filtered out).
// Paper trading
s.paper.cash -= amountUsd;
h.qty += qty;
h.avgEntry = (h.avgEntry * oldQty + price * qty) / newQty;
// Live Trading (Binance API)
await Exchange.placeLiveOrder({ symbol, side: 'BUY', type: 'MARKET', quantity: amountUsd });
System Logic: In paper mode only calculation changes (reduce cash, increase holding). Market orders are actually sent to Binance in live mode.
function run(cfg) {
for (let i = warmup; i < candles.length - 1; i++) {
const evalRes = Strategy.evaluate(candles.slice(0, i + 1), weights, opts);
// Position management and trade simulation
}
// Returns: Final Equity, Return %, Max Drawdown, Win Rate, Profit Factor
}
System Logic: This applies the strategy to past crypto market data—how much money would have been gained/lost if this system had been used. The warm-up period (60 candles) is omitted, because the indicators do not work properly at the beginning. Shows the results—last money, percentage return, maximum drawdown, win rate, and profit factor.
Crypto trading automation system application is available in browser based CryptoRazz's CryptoDevi. Also more advanced and automated functionality CryptoDev will also get almost the same function flow – it will have the following features:
Since it is a complete automation system and directly connected to the API based Binance or connected to the wallet from MetaMask, the logic flow test and virtual trade should be run only after confirmation; However with access to personal financial data it should be open-sourced rather than just kept in CryptoRazz's own system – so that there is clarity and transparency and if you can customize the system rule's production.
You can deploy CryptoDev and CryptoDevi's two program files to your own localhost (always active and must have Node.js) system; Or can deploy on your VPS system.
Both scripts are open source and can be downloaded as static files from GitHub.
Download Link :- https://github.com/HumayunShariarHimu/CryptoTrendingAutomation [Open source – you can customize it according to your trading technique if you want].
Welcome to the Web PsychoTech
Best wishes on your particular crypto trading journey – stay well.