Super Signal

Posted By: SFF

Super Signal - 02/24/13 04:19

Hi,

I have no idea how to code it in Zorro.
Could you help me?

Code:
hhb = iHighest(NULL, 0, MODE_HIGH, dist, i - dist / 2);
llb = iLowest(NULL, 0, MODE_LOW, dist, i - dist / 2);




The origianal code is found here.
http://hot-fx.blogspot.com
Posted By: TankWolf

Re: Super Signal - 02/24/13 04:45

That link doesnt show any code post the whole thing then I might be able to help. There is obviously a dist variable that needs to be calced for that code to work.
Posted By: SFF

Re: Super Signal - 02/24/13 04:46

You can download it here.
http://hot-fx.blogspot.jp/2012/03/ufs-forex.html

Code:
//+------------------------------------------------------------------+
//|                                                super-signals.mq4 |
//|                Copyright ゥ 2006, Nick Bilak, beluck[AT]gmail.com |
//|------------------------------------------------------------------|
//|Added sound,if signal direction changes  SuperSignalsHotFxMOD.mq4 |
//|2012.03.20, HotFx, http://hot-fx.blogspot.com http://hotfx.0pk.ru |
//+------------------------------------------------------------------+
#property copyright "Copyright ゥ 2006, Nick Bilak"
#property link      "http://www.forex-tsd.com/"

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_width1 2
#property indicator_color2 Blue
#property indicator_width2 2

extern int dist = 24;
extern int SignalGap = 4;
extern string SoundEntry = "news.wav";

double b1[], b2[], cur = 0;

int init()
 {
  SetIndexStyle(0, DRAW_ARROW, STYLE_SOLID, 1); SetIndexArrow(0, 234); SetIndexBuffer(0, b1);
  SetIndexStyle(1, DRAW_ARROW, STYLE_SOLID, 1); SetIndexArrow(1, 233); SetIndexBuffer(1, b2);
 }

int start()
 {
  int i, hhb, llb, counted_bars = IndicatorCounted();
  if (counted_bars > 0) counted_bars--;
  for (i = Bars - 1 - counted_bars; i >= 0; i--)
   {
    hhb = iHighest(NULL, 0, MODE_HIGH, dist, i - dist / 2);
    llb = iLowest(NULL, 0, MODE_LOW, dist, i - dist / 2);
    if (i == hhb)
     {
      if (SoundEntry != "" && cur != -1 && i <= dist) PlaySound(SoundEntry);
      b1[i] = High[hhb] + SignalGap * Point; cur = -1;
     }
    if (i == llb)
     {
      if (SoundEntry != "" && cur != 1 && i <= dist) PlaySound(SoundEntry);
      b2[i] = Low[llb] - SignalGap * Point; cur = 1;
     }
   }
 }

Posted By: SFF

Re: Super Signal - 02/27/13 09:39

I don't know how to code "i - dist / 2" as index.
Could you please code it in Zorro?
Posted By: jcl

Re: Super Signal - 02/27/13 09:47

That is the shift parameter. In C you shift a series by adding the shift parameter to the series pointer, like "High+i-dist/2" - see the example in Workshop 4.
Posted By: SFF

Re: Super Signal - 02/27/13 10:28

HH and LL only takes one parameter.
Where to insert this line?
i - dist / 2

Is this indentical to the above code?
Code:
vars hhb = series(HH(dist));
vars llb = series(LL(dist));
var newh = hhb + i - dist / 2;
var newl = llb + i - dist / 2;

Posted By: jcl

Re: Super Signal - 02/27/13 11:15

Your code is wrong, but the idea is right. Shift the output series is equivalent to shifting the input series.

You can also use MaxVal instead of HH.
Posted By: SFF

Re: Super Signal - 02/27/13 11:31

Thanks.

I just wrote this code and it looks fine and is identical to the original.
What do you think?
Code:
int i, dist;
	vars high = series(priceHigh(i - dist / 2));
	MaxVal(high,dist);
	vars low = series(priceLow(i - dist / 2));
	MinVal(low,dist);

Posted By: SFF

Re: Super Signal - 02/27/13 11:42

I codeed this but it says Error 045: Negative price offset at bar 1.
What do it mean?

Code:
function run(){
	
	
	int dist = 24;
	
	vars high = series(priceHigh(0 - dist / 2));
	var  lasthigh = MaxVal(high,dist);
	vars low = series(priceLow(0 - dist / 2));
	var lastlow = MinVal(low,dist);
	
	if(priceHigh(0) == lasthigh)
	enterShort();
	
	if(priceLow(0) == lastlow)
	enterLong();
}

Posted By: jcl

Re: Super Signal - 02/27/13 12:53

It means that the shift is negative. It must be >= 0, so remove that minus sign before dist.

Also, your code above will never trade because you compare with ==. Two vars are almost never exactly identical, so you must use >= or <= for comparing vars. Only ints can be compared with ==.
© 2024 lite-C Forums