Programmazione Visual Trader Raccolta indicatori e TS per Visualtrader (1 Viewer)

bomberone1

Nuovo forumer
C'e' qualcuno che puo trasformare questo codice del CVD in linguaggio del VT
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;

Ivan questo indicatore se non sbaglio è la pressione del book, detto anche CVD?
 

100pezzi

Nuovo forumer
IntradayIntensity:

Codice:
VAR: IISTD,IISTDN,ZONA1,ZONA2;

SETCALCOSCARRAY(true);

IISTD = Summation ((((2*C-H-L)/(H-L))*V),21);
IISTDN = (IISTD/Summation (V,21)) * 100;

ZONA1 = Createviewport (100, true, true);
ZONA2 = Createviewport (100, true, true);
Plotchart(IISTD, zona1, lime ,istogramma, 2);
Plotchart(IISTDN, zona2, red ,istogramma, 2);
 

bomberone1

Nuovo forumer
IntradayIntensity:

Codice:
VAR: IISTD,IISTDN,ZONA1,ZONA2;

SETCALCOSCARRAY(true);

IISTD = Summation ((((2*C-H-L)/(H-L))*V),21);
IISTDN = (IISTD/Summation (V,21)) * 100;

ZONA1 = Createviewport (100, true, true);
ZONA2 = Createviewport (100, true, true);
Plotchart(IISTD, zona1, lime ,istogramma, 2);
Plotchart(IISTDN, zona2, red ,istogramma, 2);

Mettiamoci pure questo

trade intensity o PaceOfTape

FOnte
Pace of Tape Indicator Trade With The Flow

Trade Intensity - Traders Laboratory Forums
Codice:
inputs: period(30), threshold(600), normcolor(blue), highcolor(red);

vars:
  int pace(0),
  int indx(0);
  
pace = 0;
indx = 0; 
while(indx < CurrentBar) begin
  value1 = time_s - time_s[indx];
  if(value1 < 0) then value1 = time_s + 240000 - time_s[indx];
  if(value1 < period) then pace = pace + barinterval
  else break;
  indx = indx + 1; 
end;

plot1(pace,"pace",iff(pace > threshold,highcolor,normcolor));

Manca l'accelerazione volumi, non riesco a trovarlo su Traders Laboratory,
anche se mi sembra nel topic VSA, che non ho ancora finito di leggere. Se lo trovo lo posto.
Grazie 100pezzi per il tuo sforzo di codifica.
 

ivan8

Nuovo forumer
errore nel intrady intesity

Per Bomerone e per 100 pezzi che ringrazio molto per la loro disponibilita.Volevo informarvi che quando copio il nuovo TS appena inserito da voi Intraday intesity mi esce l'errore alla voce
SETCALCOSCARRAY(true);
 

100pezzi

Nuovo forumer
Per Bomerone e per 100 pezzi che ringrazio molto per la loro disponibilita.Volevo informarvi che quando copio il nuovo TS appena inserito da voi Intraday intesity mi esce l'errore alla voce
SETCALCOSCARRAY(true);

probabilmente non hai la beta 5.4 installata di visualtrader
 

andgui

Forumer storico
Programma gratuito in metatrader di gery18, che è in testa oggi alla gara di TS.
EMAplusWPR_V2 - MQL4 Code Base

Chi ha tempo e voglia di tradurlo per VT

//+------------------------------------------------------------------+
#property copyright "Copyright © 2011, [email protected]"

#define NONE 0
#define UP 1
#define DOWN 2

extern string separator1 = "------trend settings------";
extern bool useEMAtrend = true; // trade in EMA trend
extern int barsInTrend = 1; // how many bars should be in trend
extern double EMAtrend = 144; // EMA period for trend

extern string separator2 = "------WPR settings------";
extern double iWPRPeriod = 46; // WPR period for enter and exit
extern double iWPRRetracement = 30; // minimal retracement for WPR to allow another trade
extern bool useWPRExit = true; // use exit with WPR indicator

extern string separator3 = "------position settings------";
extern double lots = 0.1; // fixed lot size
extern int maxTrades = 2; // max trades allowed for pyramiding
extern double stop_loss = 50; // stop loss
extern double take_profit = 200; // take profit
extern bool useTrailingStop = false; // use trailing stop
extern double trailing_stop = 10; // trail stop loss
extern bool useUnprofitExit = false; // exit trade when trade was not in profit in defined amount of bars
extern int maxUnprofitBars = 5; // amount of bars not in profit

extern double magicNumber = 13131;

double stopLoss, takeProfit, trailingStop;

bool buyBE, sellBE;

double signal;
double minAllowedLot, lotStep, maxAllowedLot;

int unprofitBars=0;

double pips2dbl;

datetime barTime=0;
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----

Comment("Copyright © 2011, Matus German");

if (Digits == 5 || Digits == 3) // Adjust for five (5) digit brokers.
{
pips2dbl = Point*10;
}
else
{
pips2dbl = Point;
}

stopLoss = pips2dbl*stop_loss;
takeProfit = pips2dbl*take_profit;
trailingStop = pips2dbl*trailing_stop;

minAllowedLot = MarketInfo(Symbol(), MODE_MINLOT); //IBFX= 0.10
lotStep = MarketInfo(Symbol(), MODE_LOTSTEP); //IBFX= 0.01
maxAllowedLot = MarketInfo(Symbol(), MODE_MAXLOT ); //IBFX=50.00

if(lots < minAllowedLot)
lots = minAllowedLot;
if(lots > maxAllowedLot)
lots = maxAllowedLot;
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
//----
if(IsNewBar())
{
if(IsProfitOnBar())
unprofitBars=0;
else
unprofitBars++;
}

// calculate iWPR for the buy/sell signal
signal=iWPR(NULL,0,iWPRPeriod,0);

// calculate if iWPR has made the defined retracement to permit another buy trade
if (signal > -100+iWPRRetracement)
{
buyBE = 1;
}

// calculate if iWPR has made the defined retracement to permit another sell trade
if (signal < 0-iWPRRetracement)
{
sellBE = 1;
}
if(!CloseOrderCheck())
return;

if(useTrailingStop)
if(!TrailingStopCheck())
return;

if(!OpenOrderCheck())
return;

//----
return(0);
}

//////////////////////////////////////////////////////////////////////////////////////////////////
bool EnterBuyCondition()
{
if(useEMAtrend)
if(Trend()!=UP)
return(false);

if (signal<-99.99 && buyBE==1)
return (true);

return (false);
}

//////////////////////////////////////////////////////////////////////////////////////////////////
bool EnterSellCondition()
{
if(useEMAtrend)
if(Trend()!=DOWN)
return(false);

if (signal>-0.01 && sellBE==1)
return (true);

return (false);
}

//////////////////////////////////////////////////////////////////////////////////////////////////
bool ExitBuyCondition()
{
if(useUnprofitExit)
if(unprofitBars>maxUnprofitBars)
return(true);

if(useWPRExit)
{
if (signal>-0.01)
{
return (true);
}
}
return (false);
}

//////////////////////////////////////////////////////////////////////////////////////////////////
bool ExitSellCondition()
{
if(useUnprofitExit)
if(unprofitBars>maxUnprofitBars)
return(true);

if(useWPRExit)
{
if (signal<-99.99)
{
return (true);
}
}
return (false);
}

//////////////////////////////////////////////////////////////////////////////////////////////////
bool CloseOrderCheck()
{
int total=OpenTradesForMNandPairType(magicNumber, Symbol());
for(int cnt=total-1;cnt>=0;cnt--)
{
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
if( OrderType()<=OP_SELL // check for opened position
&& OrderSymbol()==Symbol() // check for symbol
&& OrderMagicNumber() == magicNumber) // my magic number
{
if(OrderType()==OP_BUY) // long position is opened
{
// should it be closed?
if(ExitBuyCondition())
{
if(OrderClose(OrderTicket(),OrderLots(),Bid,3,Violet)) // close position
{
return (true);
}
return(false);
}
}
else // go to short position
{
// should it be closed?
if(ExitSellCondition())
{
if(OrderClose(OrderTicket(),OrderLots(),Ask,3,Violet)) // close position
{
return (true);
}
return(false);
}
}
}
}
return (true);
}

//////////////////////////////////////////////////////////////////////////////////////////////////
bool OpenOrderCheck()
{
int ticket;
int total=OpenTradesForMNandPairType(magicNumber, Symbol());

if(total<maxTrades)
{
// check for long position (BUY) possibility
if(EnterBuyCondition())
{
ticket=OrderSend(Symbol(),OP_BUY,lots,Ask,3, Ask-stopLoss,Ask+takeProfit,"AOS_JoeChalhoub_FXForecasterV1",magicNumber,0,Green);
if(ticket>0)
{
if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES))
{
buyBE=0;
Print("BUY order opened : ",OrderOpenPrice());
return (true);
}
}
else
{
Print("Error opening BUY order : ",GetLastError());
return(false);
}
}

// check for short position (SELL) possibility
if(EnterSellCondition())
{
ticket=OrderSend(Symbol(),OP_SELL,lots,Bid,3, Bid+stopLoss,Bid-takeProfit,"AOS_JoeChalhoub_FXForecasterV1",magicNumber,0,Red);
if(ticket>0)
{
if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES))
{
sellBE=0;
Print("SELL order opened : ",OrderOpenPrice());
return (true);
}
}
else Print("Error opening SELL order : ",GetLastError());
return (false);
}
}
return (true);
}

//////////////////////////////////////////////////////////////////////////////////////////////////
bool TrailingStopCheck()
{
double newStopLoss;
int total=OrdersTotal();
for(int cnt=total-1;cnt>=0;cnt--)
{
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
if( OrderType()<=OP_SELL // check for opened position
&& OrderSymbol()==Symbol() // check for symbol
&& OrderMagicNumber() == magicNumber) // my magic number
{
if(OrderType()==OP_BUY) // long position is opened
{
// should it be modified?
newStopLoss = TrailingStopBuy();
if(newStopLoss > 0)
{
if(OrderModify(OrderTicket(),OrderOpenPrice(),newStopLoss,OrderTakeProfit(),0,Green)) // modify position
{
return (true);
}
return(false);
}
}
else // go to short position
{
// should it be modified?
newStopLoss = TrailingStopSell();
if(newStopLoss > 0)
{
if(OrderModify(OrderTicket(),OrderOpenPrice(),newStopLoss,OrderTakeProfit(),0,Green)) // modify position
{
return (true);
}
return(false);
}
}
}
}
return (true);
}

//////////////////////////////////////////////////////////////////////////////////////////////////
double TrailingStopBuy()
{
double newStopLoss;

newStopLoss=Ask-stopLoss;
if((newStopLoss-trailingStop)>OrderStopLoss())
return (newStopLoss);
return (0);
}

//////////////////////////////////////////////////////////////////////////////////////////////////
double TrailingStopSell()
{
double newStopLoss;

newStopLoss=Bid+stopLoss;
if((newStopLoss+trailingStop)<OrderStopLoss())
return (newStopLoss);

return (0);
}

//////////////////////////////////////////////////////////////////////////////////////////////////
int OpenTradesForMNandPairType(int iMN, string sOrderSymbol)
{
int icnt, itotal, retval;

retval=0;
itotal=OrdersTotal();

for(icnt=itotal-1;icnt>=0;icnt--) // for loop
{
OrderSelect(icnt, SELECT_BY_POS, MODE_TRADES);
// check for opened position, symbol & MagicNumber
if (OrderSymbol()== sOrderSymbol)
{
if (OrderMagicNumber()==iMN)
retval++;
} // sOrderSymbol
} // for loop

return(retval);
}

///////////////////////////////////////////////////////////////////////////////////////////////////
int Trend()
{
int count=0;
int curTrend = NONE;

for(int j=0;j<barsInTrend;j++)
{
if(iMA(NULL,0,EMAtrend,0,MODE_EMA,PRICE_MEDIAN,j+1)>iMA(NULL,0,EMAtrend,0,MODE_EMA,PRICE_MEDIAN,j))
count--;
if(iMA(NULL,0,EMAtrend,0,MODE_EMA,PRICE_MEDIAN,j+1)<iMA(NULL,0,EMAtrend,0,MODE_EMA,PRICE_MEDIAN,j))
count++;
}

if(count == barsInTrend)
curTrend=UP;
if(count == -(barsInTrend))
curTrend=DOWN;

return (curTrend);
}

///////////////////////////////////////////////////////////////////////////////////////////////////
bool IsNewBar()
{
if( barTime < Time[0])
{
// we have a new bar opened
barTime = Time[0];
return(true);
}
return (false);
}

///////////////////////////////////////////////////////////////////////////////////////////////////
bool IsProfitOnBar()
{
int icnt, itotal;
itotal=OrdersTotal();
if(itotal==0)
return(true);

for(icnt=itotal-1;icnt>=0;icnt--) // for loop
{
OrderSelect(icnt, SELECT_BY_POS, MODE_TRADES);
// check for opened position, symbol & MagicNumber
if (OrderSymbol()== Symbol() && OrderMagicNumber()==magicNumber)
{
if (OrderProfit()>0)
return(true);
}
} // for loop
return(false);
}


Buon lavoro.

andgui.
 

ivan8

Nuovo forumer
Indicatore di Andgui

Scusa Andgui,ho scaricato l'indicatore che hai postato dal sito .L'ho inserito in MT4 e qunado lo lancio non esce nulla.
 

Users who are viewing this thread

Alto