Problem using old indicator need help on start() vs on calculate()
-
Please help, I have looked for hours on end trying to find a simple vwop indicator that is compatible with EA, the one I have and the only one I could find is old version meaning it uses on start() instead of on calculate () and the EA does not work at all, I am looking for some help, I want to make a crossover EA with the vwop and a simple moving average, or maybe someone can explain how to either convert a trading view indicator to mt4 for EA or provide me with a simple mt4 vwop, all of the ones I have found include bands and all sorts of stuff, I simply want a regular one I will include a screen shot from trading view, PLEASE HELP THANK YOU!!!!!
Brian
-
-
HI.
what is your algorithm? please share your project by menu "creating shared copy"
do you know how using ex4 file? have you indicator mq4 file? -
It is not created, I don't have a VWOP indicator that is compatible with EA I do have a simple mt4 VWOP indicator that works fine on chart but not in EA, I have the script for that, I just don't know how to convert the old mt4 it is such a simple strategy but I just can't get this indicator in my EA, helpppppppppp thanks!!!
this is the pine code from tradingview for vwop
//@version=3
study("VWAP", overlay=true)// There are five steps in calculating VWAP:
//
// 1. Calculate the Typical Price for the period. [(High + Low + Close)/3)]
// 2. Multiply the Typical Price by the period Volume (Typical Price x Volume)
// 3. Create a Cumulative Total of Typical Price. Cumulative(Typical Price x Volume)
// 4. Create a Cumulative Total of Volume. Cumulative(Volume)
// 5. Divide the Cumulative Totals.
//
// VWAP = Cumulative(Typical Price x Volume) / Cumulative(Volume)cumulativePeriod = input(14, "Period")
typicalPrice = (high + low + close) / 3
typicalPriceVolume = typicalPrice * volume
cumulativeTypicalPriceVolume = sum(typicalPriceVolume, cumulativePeriod)
cumulativeVolume = sum(volume, cumulativePeriod)
vwapValue = cumulativeTypicalPriceVolume / cumulativeVolumeplot(vwapValue)
-
Important: Custom indicators used in any EA must be programmed in the new MQL4 language. The MQL4 language has changed significantly since build 600 at the beginning of 2014. Old, incompatible indicators include the functions init() and start(), whereas new indicators include the functions OnInit() and OnCalculate().
-
@bsalamone if you have indicator please attach here and i can help you.
if you haven't correct indicator then programmer users should help you. sorry -
//+------------------------------------------------------------------+
//| VWAP.mq4 |
//| mwfx108 |
//| mwfx108@gmail.com |
//| Like my stuff? Made some profits using it? |
//| Donate ETH @ 0xeDC0D4Dd8abcB106FEdC17Ce07Cc68a6571a038e |
//+------------------------------------------------------------------+
#property copyright "mwfx108"
#property link "mwfx108@gmail.com"
#property version "1.00"
#property strict
#property indicator_buffers 1
#property indicator_chart_window
#property indicator_color1 Red
//+------------------------------------------------------------------+
//| Variables |
//+------------------------------------------------------------------+
double ExtBufferVWAP[];
double __ohlcvTotal,
__volumeTotal;
datetime __sessionStartTime;//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//---__volumeTotal = 0;
__ohlcvTotal = 0;
__sessionStartTime = 0;IndicatorShortName( "VWAP" );
IndicatorDigits( _Digits );//--- Drawing settings
SetIndexStyle( 0, DRAW_LINE );//--- Indicator buffers mapping
SetIndexBuffer( 0, ExtBufferVWAP );//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
const int prev_calculated,
const datetime &time[],
const double &open[],
const double &high[],
const double &low[],
const double &close[],
const long &tick_volume[],
const long &volume[],
const int &spread[])
{
//---// An "Intraday" indicator makes no sense anymore above H1
if ( Period() >= PERIOD_H4 )
{
return ( rates_total - 1 );
}int startIndex = MathMax( 0, rates_total - prev_calculated - 1 );
// Only calculate up until the previous bar. We don't want to calculate the current bar.
if ( startIndex > 0 )
{
for ( int i = startIndex; i >= 1; i-- )
{
double
ohlcAvg = ( open[ i ] + high[ i ] + low[ i ] + close[ i ] ) / 4,
vol = ( double ) tick_volume[ i ];// Reset values when session changed if ( TimeDay( time[ i ] ) != TimeDay ( __sessionStartTime ) ) { __sessionStartTime = time[ i ]; __ohlcvTotal = 0; __volumeTotal = 0; } __ohlcvTotal += ohlcAvg * vol; __volumeTotal += vol; ExtBufferVWAP[ i ] = NormalizeDouble( __ohlcvTotal / __volumeTotal, _Digits ); }}
return( rates_total - 1 );
}
//+------------------------------------------------------------------+ -
-
@bsalamone this working perfect in meta4 and then working in Fxdreema. what is exactly your problem?
do you know how you should use that? -
-
what do you want to use it?
-
-
when I run the EA it makes absolutely no trades at all ... I have been trying to figure this out for days so very frustrating
-
@bsalamone yes i checked your indicator that has a problem for loaded in EA
you should find better version
-
@bsalamone 0_1585710504624_vwap.mq5
it is for mt5 you can test your strategy
-
Disconnect those 'Close trades' blocks and create an independent tree structure for them.
-
@xfire I have been trying to find a better version for days!!! I DONT UNDERSTAND LOL
-
Did you try Xfire's EA for mq5?
-
@l-andorrà
No. i will check -
@xfire said in Problem using old indicator need help on start() vs on calculate():
@l-andorrà
No. i will checkMy question was for Bsalamone.

bsalamone 
