Programmazione Visual Trader Supervolume

100pezzi

Nuovo forumer
Incuriosito, ho provato a codificare questa tecnica di Aldrovandi x vt

a me non sembra granche ma se volete dare il vs contributo...

Codice:
Var: strend;
var: PriceW(0),ShareW(0),Count(0),VolWAPValue(0),VolWAPVariance(0),value1,value2,value3,VolWAPSD(0);

if isfirstbarday then
d > d[1];
PriceW = 0;
ShareW = 0;
Count = -1;
Value1 = 0;
Value2 = 0;
VolWAPValue = 0;
endif;
PriceW = PriceW + (A * V);
ShareW = ShareW + V;
Count = Count + 1;
Value3 = 0;
if ShareW > 0 then VolWAPValue =(PriceW /ShareW);
endif;
beginfor (value1, 1, count);
Value2 = (V[Value1]/ShareW) * ((AvgPrice[Value1]-VolWAPValue)* (AvgPrice[Value1]-VolWAPValue));
Value3 = Value3 + Value2;
endfor;

VolWAPVariance = Value3;
VolWAPSD = Sqrt(VolWAPVariance);

strend = supertrend (c, 3, 2);

if crossover (c,STREND) and STREND<VolWAPValue then EnterLong(NextBar, atopen);endif;
if crossunder (c,STREND) and strend>VolWAPValue then EnterShort(NextBar, atopen);endif;

if positiondir=1 and barsince (c>(volwapvalue+(2*VolWAPSD)))>2 then Exitlong (bar, atclose);endif;
if positiondir=-1 and barsince (c<(volwapvalue-(2*VolWAPSD)))>2 then Exitshort (bar, atclose);endif;

if positiondir=1 and c<volwapvalue or c<strend then Exitlong (bar, atclose);endif;
if positiondir=-1 and c>volwapvalue or c>strend then Exitshort (bar, atclose);endif;

///PLOT///
plotchart(strend,0,green,solid,3);
PlotChart(volwapvalue, 0, black, solid, 1);
PlotChart((volwapvalue+(2*VolWAPSD)), 0, black, solid, 1);
PlotChart((volwapvalue-(2*VolWAPSD)), 0, black, solid, 1);
 
Questa è la strategia,
Il target.
La strategia prevede
l’ingresso al rialzo al verificarsi
di due condizioni: il prezzo
supera dal basso verso l’alto il
Super Trend, che a sua volta si
trova in posizione superiore alla
linea del Vwap centrale. Analogamente
si avrà un ingresso al
ribasso quando il prezzo buca
dall’alto verso il basso il Super
Trend e questo si trova sotto il
Vwap.

Quest’ultimo viene utilizzato
nella gestione della posizione:
il trade al rialzo viene
chiuso a target con due chiusure
sopra la linea più alta del
Vwap. Analogamente il trade
al ribasso viene chiuso con due
chiusure più basse sotto la linea
estrema inferiore del Vwap.

Lo stop loss.
«In caso di trend
avverso», ha spiegato Aldrovandi,
«il trade viene chiuso,
per le operazioni rialziste quando
i prezzi tornano a incrociare
dall’alto verso il basso il più vicino
fra il Super Trend e la linea
intermedia del Vwap».
In caso di operazione ribassista, invece,
il trade viene chiuso
quando i prezzi tornano
sopra il più vicino fra il
Super Trend o il Vwap.

Pertanto mi sembra che bisogna invertire
if crossover (c,STREND) and STREND<VolWAPValue then EnterLong(NextBar, atopen);endif; if crossunder (c,STREND) and strend>VolWAPValue then EnterShort(NextBar, atopen);endif;

con questo codice
if crossover (c,STREND) and STREND>VolWAPValue then EnterLong(NextBar, atopen);endif; if crossunder (c,STREND) and strend<VolWAPValue then EnterShort(NextBar, atopen);endif;

Bisogna mettere il breakeven, io mettere il break even in questo modo.
Dal prezzo di entrata aggiungerei il valore dell ATR a 8 periodi per il long, mentro meno il valore dell ' ATR a 13 per lo short.
 
intendi così?

Codice:
Var: strend;
var: PriceW(0),ShareW(0),Count(0),VolWAPValue(0),VolWAPVariance(0),value1,value2,value3,VolWAPSD(0);
Var: amp,EL,ES;

if isfirstbarday then
d > d[1];
PriceW = 0;
ShareW = 0;
Count = -1;
Value1 = 0;
Value2 = 0;
VolWAPValue = 0;
endif;
PriceW = PriceW + (A * V);
ShareW = ShareW + V;
Count = Count + 1;
Value3 = 0;
if ShareW > 0 then VolWAPValue =(PriceW /ShareW);
endif;
beginfor (value1, 1, count);
Value2 = (V[Value1]/ShareW) * ((AvgPrice[Value1]-VolWAPValue)* (AvgPrice[Value1]-VolWAPValue));
Value3 = Value3 + Value2;
endfor;

VolWAPVariance = Value3;
VolWAPSD = Sqrt(VolWAPVariance);

strend = supertrend (c, 3, 2);
EL=O+ATR(C, 8);
ES=O-ATR(C, 13);

if c>STREND and STREND>VolWAPValue and c>el then EnterLong(NextBar, atopen);endif;
if c<STREND and strend<VolWAPValue and c<es then EnterShort(NextBar, atopen);endif;


if positiondir=1 and barsince (c>(volwapvalue+(2*VolWAPSD)))>2 then Exitlong (bar, atclose);endif;
if positiondir=-1 and barsince (c<(volwapvalue-(2*VolWAPSD)))>2 then Exitshort (bar, atclose);endif;

if positiondir=1 and c<volwapvalue or c<strend then Exitlong (bar, atclose);endif;
if positiondir=-1 and c>volwapvalue or c>strend then Exitshort (bar, atclose);endif;

///PLOT///
plotchart(strend,0,green,solid,3);
PlotChart(volwapvalue, 0, black, solid, 1);
PlotChart((volwapvalue+(2*VolWAPSD)), 0, black, solid, 1);
PlotChart((volwapvalue-(2*VolWAPSD)), 0, black, solid, 1);
 
per 100 pezzi

Ho questo codice e altri del cumulative delta.Puoi dirmi se puoi trasformarlo nel linguaggio di visual trader?
Volume Splitter - Page 5 - Traders Laboratory Forums
// author: BlowFish
//
// Plots Cumulative Delta
//
// Start at the begining of day and plot as a 'bar'
//
inputs:
UpColor(darkgreen),
DownColor(red),
MaxBlock(9999),
MinBlock(0),
ResetDeltaEachBar(0);

variables:
MyVol(0),
Block(0),
color(yellow),
firstrunthrough(true),
intrabarpersist MyCurrentBar(0),
intrabarpersist VolTmp(0),
intrabarpersist Deltac (0),
intrabarpersist DeltaH (0),
intrabarpersist DeltaL (0),
intrabarpersist DeltaO (0);

if firstrunthrough then begin // We need to do this in case indicator starts mid bar
Voltmp = Iff(BarType < 2, Ticks, Volume);
firstrunthrough = False;
end;

if LastBarOnChart then begin
if CurrentBar > MyCurrentBar then begin
VolTmp = 0;
MyCurrentBar = CurrentBar;
if ResetDeltaEachbar = 1 then Deltac =0;
DeltaO = Deltac;
DeltaH = Deltac;
DeltaL = Deltac;
end;
MyVol = Iff(BarType < 2, Ticks, Volume);
Block = Myvol - VolTmp;
if (Block >= MinBlock) and (Block <= MaxBlock) then
if Close <= InsideBid then
Deltac = Deltac - MyVol + VolTmp
else if Close >= InsideAsk then
Deltac = Deltac + MyVol - VolTmp ;
VolTmp = MyVol ;


DeltaH = maxlist(DeltaH, Deltac);
DeltaL = minlist(DeltaL, Deltac);


if Deltac <= Deltal[1] then
color = DownColor
else
if Deltac >= Deltah[1] then
color = UpColor
else
color = color[1];

plot1(DeltaO, "DO",color);
Plot2(DeltaH, "DH",color);
Plot3(DeltaL, "DL",color);
plot4(Deltac, "DC",color);
end;
 
Ciao 100 pezzi,

allora cosi non va bene.
Dal prezzo di entrata, metti che siamo entrati long a 1250, dal quel prezzo li si prende il valore ATR
e lo si aggiunge al nostro prezzo, pertanto se il valore viene 30. Il break a 1280.
Però il break even non è un targhet ma uno stop, pertanto bisogna che il prezzo lo deve superare di qualche tick metti 5 e poi si setta appunto a
1280.
Pertanto il prezzo deve andare a 1285 e li scatta il break even a 1280.
CIao
 
Ho questo codice e altri del cumulative delta.Puoi dirmi se puoi trasformarlo nel linguaggio di visual trader?
Volume Splitter - Page 5 - Traders Laboratory Forums
// author: BlowFish
//
// Plots Cumulative Delta
//
// Start at the begining of day and plot as a 'bar'
//
inputs:
UpColor(darkgreen),
DownColor(red),
MaxBlock(9999),
MinBlock(0),
ResetDeltaEachBar(0);

variables:
MyVol(0),
Block(0),
color(yellow),
firstrunthrough(true),
intrabarpersist MyCurrentBar(0),
intrabarpersist VolTmp(0),
intrabarpersist Deltac (0),
intrabarpersist DeltaH (0),
intrabarpersist DeltaL (0),
intrabarpersist DeltaO (0);

if firstrunthrough then begin // We need to do this in case indicator starts mid bar
Voltmp = Iff(BarType < 2, Ticks, Volume);
firstrunthrough = False;
end;

if LastBarOnChart then begin
if CurrentBar > MyCurrentBar then begin
VolTmp = 0;
MyCurrentBar = CurrentBar;
if ResetDeltaEachbar = 1 then Deltac =0;
DeltaO = Deltac;
DeltaH = Deltac;
DeltaL = Deltac;
end;
MyVol = Iff(BarType < 2, Ticks, Volume);
Block = Myvol - VolTmp;
if (Block >= MinBlock) and (Block <= MaxBlock) then
if Close <= InsideBid then
Deltac = Deltac - MyVol + VolTmp
else if Close >= InsideAsk then
Deltac = Deltac + MyVol - VolTmp ;
VolTmp = MyVol ;


DeltaH = maxlist(DeltaH, Deltac);
DeltaL = minlist(DeltaL, Deltac);


if Deltac <= Deltal[1] then
color = DownColor
else
if Deltac >= Deltah[1] then
color = UpColor
else
color = color[1];

plot1(DeltaO, "DO",color);
Plot2(DeltaH, "DH",color);
Plot3(DeltaL, "DL",color);
plot4(Deltac, "DC",color);
end;
mi dispiace ma ho poca dimestichezza con ninjatrader, se c'è qualcuno + esperto di me benvenga ciao
 
altro ts nel linguaggio di tredestation per 100 pezzi

grazie per avermi risposto.100 pezzi.Cmq ho un altro ts di tradestation quello lo puoi tradurre nel linguaggio vt.Se non puoi aiutarmi nemmeno in questo come posso tradurre questi due ts nel linguaggio di vt?
 
per 100 pezzi volume bias

// Volume Bias (TradeStation version)
// version: beta 0.1a
// Author: TAMS
// Date: 20090627
// Licence: Public use
//
// Description:
// This indicator prints the volume bias on the chart
//
// Volume Bias is calculated as Up Volume divided by Total Volume.
// i.e. The percetage of total volume that has an upward bias.
// when there are more up volume than down volume,
// the display will show a larger than 50% bias.
// Otherwise the display will show a smaller than 50% bias.
//
// The color will turn blue if the bias is over 55%
// The color will turn red if the bias is under 45%
// otherwise the color will be a neutral color
//
// the display is formated as follow:
// UpVolume:DownVolume:UpBias%
//
// You may choose the display at position 1 or 2
// Position 1 refers to the top of the chart, 2 is the bottom.
//
inputs:
Position_1or2(1),
Upcol(blue),
Dncol(red),
Text.col(yellow),
Neucol(darkgray);
variables:
id.txt(0),
vol.bias(0),
color(0);

if currentbar = 1 then
begin
id.txt = text_new(d, time, c[1], "");
end;
if ticks > 0 then
vol.bias = upticks / ticks
else
vol.bias = 0;
Text_setstring(id.txt, " " + NumToStr(upticks, 0)+ ":"+ NumToStr(downticks, 0)+"="+ NumToStr(vol.bias *100, 0) + "% ");
if Position_1or2 = 1 then
begin
Text_setlocation(id.txt, date, time, getappinfo(aihighestDispValue));
text_setstyle(id.txt, 1, 0);
end
else
begin
Text_setlocation(id.txt, date, time, getappinfo(ailowestDispValue));
text_setstyle(id.txt, 1, 1);
end;
{======================================}

if vol.bias > 0.55 then
begin
Text_Setcolor (id.txt , upcol);
end
else
if vol.bias < 0.45 then
begin
Text_Setcolor (id.txt , dncol);
end
else
begin
Text_Setcolor (id.txt , neucol);
end;
{======================================}
 

Users who are viewing this thread

Back
Alto