Ask! - page 169

 

Offline Chart Indicator

Kalenzo:
There is nothing special you need to code inside the indicator. Just drag & drop the indicator from nagivator to offline chart and it will work. Try it first with normal data avaliable with metatrader, for example eurusd. If the indicator will work on eurusd and won't on NYSE then it means that indicator counts something in wrong way and needs to be fixed/adjusted (for example maybe it needs rounding or during the calculations it generates error like zero divide).

Hi Kalenzo,

Thanks for your reply. The MT4 platform indicators work great. It's a custom indicator that a individual coded that won't work. I'm noticed in the code the currency symbols. I was wondering if I need to change the symbols from the currency pairs GBPUSD to the NYSE symbol? I was also wanted to know how indicators work. What data in what folder do the indicators whether the indicators that were originally installed in the platform or is you download a free custom coded indicator?

Thanks!!

 
winsumloosesum:
Hi Kalenzo,

Thanks for your reply. The MT4 platform indicators work great. It's a custom indicator that a individual coded that won't work. I'm noticed in the code the currency symbols. I was wondering if I need to change the symbols from the currency pairs GBPUSD to the NYSE symbol? I was also wanted to know how indicators work. What data in what folder do the indicators whether the indicators that were originally installed in the platform or is you download a free custom coded indicator?

Thanks!!

Hello!

Yes, definitely you need to check indicator code. If your indicator is not using Symbol() function (or NULL value instead of symbol where it is needed) then it's the problem for 100%. Usually the indicator transforms data from the chart they are attached to, thus why the original MT4 indicators works. However, in custom indicators you can take data from other symbols/timeframes and then you need to specify manually which data you wish to use. For example you may use EURUSD as base and use also GBPUSD and USDCHF as some other parameters for calculation.

You need to check the indicator code, and change symbols to NYSE that you wish to calculate. Then it will work fine.

 

Thanks again for your help

Thanks again for all your help.

 

Debuging problem

I write a basic EA to understand the functioning of indicators, but i had some surprise. First with repainting indy and now with very basic indy .

To understand the numbers i use a print() function to print values in the log report durin a backtest. But the print function seems disturb the log print and i loose a big part of the log. removing the print and the log is complete with all the orders!

Any idea? Here an extract of my code

//----+ DEFINING SIGNALS FOR TRADES

if (kline[1] < Level_Up) // under treshold

if (kline[0] > dline[0]) // Main Over Signal

if (kline[0] > kline[1]) // Main must go up

if (dline[0] > 0 ) { //Signal must nost stay at zero level < dline[1]) { // Previous Main under Signal so we crossed up

BUY_Sign = true;

if (Debug) {

Print ("Longopen K0 ",DoubleToStr(kline[0],Digits)," K1 ",DoubleToStr(kline[1],Digits),

" K2 ",DoubleToStr(kline[2],Digits), "K3 ",DoubleToStr(kline[3],Digits));

Print (" D0 ",DoubleToStr(dline[0],Digits)," D1 ",DoubleToStr(dline[1],Digits)," D2 ",DoubleToStr(dline[2],Digits),

" D3 ",DoubleToStr(dline[3],Digits));

}

}

Thanks for helping

Marcel

 

Please help!! I am not a coder, But Im trying my very best here. Any advice on why my indicator wont work would be much appreciated!!

Thank you in advance

#property indicator_separate_window

#property indicator_buffers 4

#property indicator_color1 LimeGreen

#property indicator_color2 FireBrick

#property indicator_color3 Green

#property indicator_color4 Red

#property indicator_width1 2

#property indicator_width2 2

#property indicator_width3 2

#property indicator_width4 2

//---------------------------------------------------------------------indicator parameters

extern int FastEMA=12;

extern int SlowEMA=26;

extern int SignalSMA=9;

//---------------------------------------------------------------------indicator buffers

double OsmaBuffer[];

double Spm;

double Smm;

double Spmaks1;

double Spmaks2;

double Smmin1;

double Smmin2;

double nou[];

double ver[];

double OsMAUP[];

double OsMADOWN[];

//+------------------------------------------------------------------+

//| Custom indicator initialization function |

//+------------------------------------------------------------------+

int init()

{

//--------------------------------------------------------------------2 additional buffers are used for counting.

IndicatorBuffers(4);

//--------------------------------------------------------------------drawing settings

SetIndexStyle(0,DRAW_HISTOGRAM);

SetIndexBuffer(0,OsMAUP);

SetIndexStyle(1,DRAW_HISTOGRAM);

SetIndexBuffer(1,OsMADOWN);

SetIndexStyle(2,DRAW_ARROW);

SetIndexArrow(2,159);

SetIndexBuffer(2,Spmaks1);

SetIndexStyle(3,DRAW_ARROW);

SetIndexArrow(3,159);

SetIndexBuffer(3,Smmin1);

SetIndexDrawBegin(0,SignalSMA);

IndicatorDigits(Digits+2);

//-------------------------------------------------------------------name for DataWindow and indicator subwindow label

IndicatorShortName("OsMA Marius("+FastEMA+","+SlowEMA+","+SignalSMA+")");

//-------------------------------------------------------------------initialization done

return(0);

}

//+------------------------------------------------------------------+

//| Moving Average of Oscillator |

//+------------------------------------------------------------------+

int start()

{

int limit;

int counted_bars=IndicatorCounted();

//-------------------------------------------------------------------last counted bar will be recounted

if(counted_bars>0) counted_bars--;

limit=Bars-counted_bars;

//-------------------------------------------------------------------Main Loop

for(int i=0; i<limit; i++)

{

OsmaBuffer=iOsMA(NULL,0,FastEMA,SlowEMA,SignalSMA,PRICE_WEIGHTED,i);

nou = OsmaBuffer;

ver = OsmaBuffer;

if(OsmaBuffer > 0)

{

OsMAUP = OsmaBuffer;

OsMADOWN = 0;

}

else

{

OsMADOWN = OsmaBuffer;

OsMAUP = 0;

}

//-------------------------------------------------------------------Cross Down

if ((nou0))

{

Spmaks1 = Spmaks2;

if(Spmaks2 > 0)

{

Spmaks2 = 0;

}

}

//-------------------------------------------------------------------Cross Up

if ((nou>0)&&(ver<0))

{

Smmin1 = Smmin2;

if(Smmin2 < 0)

{

Smmin2 = 0;

}

}

//-------------------------------------------------------------------During Swing

if(ver > 0)

{

Spm = ver;

if((nou > ver) || (nou == ver))

{

Spm = nou;

}

if((Spm > Spmaks2) || (Spm == Spmaks2))

{

Spmaks2 = Spm;

}

}

else

{

Smm = ver;

if((nou < ver) || (nou == ver))

{

Smm = nou;

}

if((Smm < Smmin2) || (Smm == Smmin2))

{

Smmin2 = Smm;

}

}

}

//--------------------------------------------------------------------done

return(0);

}

//+------------------------------------------------------------------+

 

How to draw the line among the latest 20 bars

I have a question!

I want to have an indicator about moving average .

It always keeps drawing the line among the latest 20 bars

But I don't know how to write it

I hope you can help me and offer an indicator like this .

Thanks a lot!

 

Peace everyone,

Hope all is well w/ all.

My question is a fairly simple one for those qualified in the area of programming:

I had an e.a. professionally created for me, using 3 indicators in their raw state. It's a 4 strategy system coded in one e.a. where the 3 indicators are traded in varying combinations. Just a little history but this is part is actually irrelevant.

The 3 indicators all use two buffers each and the only variable they all had was "CountBars". Since they were in a state where they weren't optimizable, being that the only adjustable option was "CountBars", I had the bright idea of using Jurik's algorithm as a sort of pre-processing. That way I could keep the indicator's raw i.e. reacting quickly but w/ several "hiccups" while adding a smoothing factor that is still very responsive and simultaneously low lagging. So I asked a well known member of this board to assist me w/ that part of the project, which they did and quite flawlessly I might add. However, because they went above and beyond the call of duty, I didn't want to ask them do me any more favors i.e. swapping in the new Jurik smoothed versions of the same indicators in place of their raw subordinates.

That being said, I figured, "How hard could it be" I thought I knew enough to do it myself. Just change the names being called in the 3 iCustom instances, add the new variables in "extern" part as well as down in the iCustoms part, (Now the JRK smthd vers of the indicators still use 2 buffers but they have an extra variable, 2 total: "SmoothLength" and "SmoothPhase". "CountBars" was removed.) and Voila!! If only it was that easy. I did those things and compiled it, no errors/warnings. However when I try to backtest/forward test, no trading.....

Am I missing something? Any and all advice will be greatly appreciated.

 

Bizzzzzump!

 
forex_for_life:
Peace everyone,

Hope all is well w/ all.

My question is a fairly simple one for those qualified in the area of programming:

I had an e.a. professionally created for me, using 3 indicators in their raw state. It's a 4 strategy system coded in one e.a. where the 3 indicators are traded in varying combinations. Just a little history but this is part is actually irrelevant.

The 3 indicators all use two buffers each and the only variable they all had was "CountBars". Since they were in a state where they weren't optimizable, being that the only adjustable option was "CountBars", I had the bright idea of using Jurik's algorithm as a sort of pre-processing. That way I could keep the indicator's raw i.e. reacting quickly but w/ several "hiccups" while adding a smoothing factor that is still very responsive and simultaneously low lagging. So I asked a well known member of this board to assist me w/ that part of the project, which they did and quite flawlessly I might add. However, because they went above and beyond the call of duty, I didn't want to ask them do me any more favors i.e. swapping in the new Jurik smoothed versions of the same indicators in place of their raw subordinates.

That being said, I figured, "How hard could it be" I thought I knew enough to do it myself. Just change the names being called in the 3 iCustom instances, add the new variables in "extern" part as well as down in the iCustoms part, (Now the JRK smthd vers of the indicators still use 2 buffers but they have an extra variable, 2 total: "SmoothLength" and "SmoothPhase". "CountBars" was removed.) and Voila!! If only it was that easy. I did those things and compiled it, no errors/warnings. However when I try to backtest/forward test, no trading.....

Am I missing something? Any and all advice will be greatly appreciated.

Hi Ffl,

Try iCustom(NULL,0," indicator name" SmoothLength,SmoothPhase,0,1) for buy and iCustom(NULL,0," indicator name" SmoothLength,SmoothPhase,1,1), for sell just change the "indicator name" to indicator you are trying to call.

 
mrtools:
Hi Ffl, Try iCustom(NULL,0," indicator name" SmoothLength,SmoothPhase,0,1) for buy and iCustom(NULL,0," indicator name" SmoothLength,SmoothPhase,1,1), for sell just change the "indicator name" to indicator you are trying to call.

Peace Mr. T,

Thanks for the guidance. I made those changes based on your suggestion and E.A. still compiles w/ no errors/warnings but also still doesn't place any trades. Will try one more work-around shortly.....