Il bitcoin (e molte cripto) sono sicuramente tra gli strumenti più interessanti per i trader, non solo per ragioni legate a ragionamenti sul potenziale di lungo termine di questo asset, ma per le caratteristiche di volatilità e direzionalità.
Volatilità e direzionalità sono da sempre la benzina del trading. Siamo tutti d’accordo che su strumenti che posseggono queste due qualità è più facile individuare delle tecniche che generino risultati economici positivi?
Il rovescio della medaglia è che la volatilità va gestita perché volatilità alta = alti rischi. Occorre quindi avere disciplina, esperienza e un buon money management.
Anche l’individuazione del time frame è importante. In certe situazioni ad altissima volatilità il time frame daily diventa troppo impegnativo, soprattutto se si utilizza la leva.
Se si fa trading daily occorre quindi anche una buona diversificazione di portafoglio.
Il trading meccanico può essere un buon modo per imparare e gestire il rischio in modo disciplinato.
In questo articolo vi forniamo un listato creato con un software (Adaptrade Builder).
Abbiamo selezionato l’impiego di una rete neurale per la condizione di entrata e utilizzato condizioni di stress test abbastanza probanti che riportiamo nell’immagine sottostante.

Qui sotto mostriamo le impostazione dello storico per la parte di:
1) Training (apprendimento in Sample);
2) Test;
3) validazione

Nell’immagine di copertina abbiamo messo le curve dei profitti derivanti dallo stress test che dimostrano una buona solidità di uno dei listati frutto dell’elaborazione.
Qui sotto il codice long/short in linguaggio Power Language di Multicharts.
{——————————————————————————-
Trading Strategy Code
Population member: 72
Max bars back: 66
Created by: Adaptrade Builder version 3.2.0.0
Created: 23/02/2021 18:28:01
Scripting language: TradeStation 6 or newer
Symbol file: E:\dati\bitcoin-Minute-Trade.txt
Build dates: 01/06/2016 to 11/02/2019
Project file: C:\Users\em3\bitcoin.gpstrat
——————————————————————————-}
{ Strategy inputs }
Inputs: NL1 (3), { Day of week (0 to 6 for Sunday to Saturday), long trades }
NL2 (1), { Day of week (0 to 6 for Sunday to Saturday), long trades }
NL3 (3), { Indicator look-back length (bars), long trades }
NL4 (64), { Indicator look-back length (bars), long trades }
NL5 (20), { Indicator look-back length (bars), long trades }
Wgt1 (-0.0729), { Neural network weight value (-1 to 1) }
Wgt2 (0.7265), { Neural network weight value (-1 to 1) }
Wgt3 (0.9114), { Neural network weight value (-1 to 1) }
EntryPctL (2.4018), { Value of percentage entry (stop/limit), long trades }
NBarExL1 (72), { Number of bars from entry for market exit if profitable, long trades }
TrailFlrL (793.61), { Trailing stop floor value per share/contract, long trades }
TrailPctL (71.0000), { Trailing stop percentage, long trades }
TargSzL (389.96), { Value of fixed size exit target per share/contract, long trades }
NBarExL2 (80), { Number of bars from entry for market exit, long trades }
TrailFlrS (533.18), { Trailing stop floor value per share/contract, short trades }
TrailPctS (89.0000), { Trailing stop percentage, short trades }
NBarExS1 (35), { Number of bars from entry for market exit, short trades }
PSParam (1.00), { Position sizing parameter value }
RoundPS (true), { Round-to-nearest (true/false) }
RoundTo (1), { Round-to position size value }
MinSize (1), { Minimum allowable position size }
SizeLimit (100); { Maximum allowable position size }
{ Variables for entry and exit prices }
Var: EntPrL (0),
TargPrL (0),
LStop (0),
NewLStop (0),
LTrailOn (false),
SStop (0),
NewSStop (0),
STrailOn (false);
{ Variables for entry and exit conditions }
Var: VarL1 (0),
VarL2 (0),
VarL4 (0),
VarL5 (0),
EntCondL (false),
EntCondS (false);
{ Variables for position sizing }
Var: NShares (0);
{ Entry price }
EntPrL = (1 + EntryPctL/100.0) * C;
{ Entry and exit conditions }
VarL1 = DayOfWeek(date);
EntCondL = VarL1 > NL1;
EntCondS = true;
{ Neural network inputs }
Array: NNInputs[3](0);
VarL2 = DayOfWeek(date);
VarL4 = Momentum(H, NL3);
VarL5 = AbsValue(VarL4);
NNInputs[0] = VarL2 – NL2;
NNInputs[1] = Average(VarL5, NL4);
NNInputs[2] = WAverage(L, NL5);
{ Evaluate neural network function }
Array: NNWeights[3](0);
Var: NNOutput(0);
NNWeights[0] = Wgt1;
NNWeights[1] = Wgt2;
NNWeights[2] = Wgt3;
NNOutput = NNCompute(NNInputs, 3, NNWeights, 3, 100);
{ Position sizing calculations }
NShares = PSParam;
If RoundPS and RoundTo > 0 then
NShares = IntPortion(NShares/RoundTo) * RoundTo;
NShares = MaxList(NShares, MinSize);
NShares = MinList(NShares, SizeLimit);
{ Entry orders }
If MarketPosition = 0 and EntCondL and NNOutput >= 0.5 then begin
Buy(“EnStop-L”) NShares shares next bar at EntPrL stop;
end;
If MarketPosition = 0 and EntCondS and NNOutput <= -0.5 then begin
Sell short(“EnMark-S”) NShares shares next bar at market;
end;
{ Exit orders, long trades }
If MarketPosition = 1 then begin
If BarsSinceEntry = 0 then begin
LStop = 0;
LTrailOn = false;
end;
If C – EntryPrice > TrailFlrL/BigPointValue then
LTrailOn = true;
If LTrailOn then begin
NewLStop = EntryPrice + TrailPctL * (C – EntryPrice)/100.0;
LStop = MaxList(LStop, NewLStop);
end;
If LTrailOn then
Sell(“ExTrail-L”) next bar at LStop stop;
TargPrL = EntryPrice + TargSzL/BigPointValue;
Sell(“ExTarg-L”) next bar at TargPrL limit;
If BarsSinceEntry >= NBarExL2 or (BarsSinceEntry >= NBarExL1 and C > EntryPrice) then
Sell(“ExMark-L”) next bar at market;
end;
{ Exit orders, short trades }
If MarketPosition = -1 then begin
If BarsSinceEntry = 0 then begin
SStop = Power(10, 10);
STrailOn = false;
end;
If EntryPrice – C > TrailFlrS/BigPointValue then
STrailOn = true;
If STrailOn then begin
NewSStop = EntryPrice – TrailPctS * (EntryPrice – C)/100.0;
SStop = MinList(SStop, NewSStop);
end;
If STrailOn then
Buy to cover(“ExTrail-S”) next bar at SStop stop;
If BarsSinceEntry >= NBarExS1 then
Buy to cover(“ExMark-S”) next bar at market;
end;
Venerdì 5 marzo dalle ore 18 alle 19 dedicheremo una serata alla progettazione di codici con algoritmi genetici, in particolare vedremo la progettazione di un algortimo per gli ETF ed uno per il bitcoin intraday.
La serata sarà gratuita e riservata a soli clienti delle rubriche di segnali operativi.
Sempre nella stessa sera, dalle 19 alle 19:30 dedicheremo una mezz’ora a consigli di money management per gli abbonati.
Per info: info@enricomalverti.com