Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
5 registered members (AndrewAMD, chsmac85, NeoDumont, dr_panther, TedMar), 1,095 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Super Signal #418359
02/24/13 04:19
02/24/13 04:19
Joined: Nov 2012
Posts: 209
S
SFF Offline OP
Member
SFF  Offline OP
Member
S

Joined: Nov 2012
Posts: 209
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

Re: Super Signal [Re: SFF] #418361
02/24/13 04:45
02/24/13 04:45
Joined: Sep 2012
Posts: 99
T
TankWolf Offline
Junior Member
TankWolf  Offline
Junior Member
T

Joined: Sep 2012
Posts: 99
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.

Re: Super Signal [Re: TankWolf] #418362
02/24/13 04:46
02/24/13 04:46
Joined: Nov 2012
Posts: 209
S
SFF Offline OP
Member
SFF  Offline OP
Member
S

Joined: Nov 2012
Posts: 209
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;
     }
   }
 }


Last edited by SFF; 02/27/13 11:33.
Re: Super Signal [Re: SFF] #418603
02/27/13 09:39
02/27/13 09:39
Joined: Nov 2012
Posts: 209
S
SFF Offline OP
Member
SFF  Offline OP
Member
S

Joined: Nov 2012
Posts: 209
I don't know how to code "i - dist / 2" as index.
Could you please code it in Zorro?

Re: Super Signal [Re: SFF] #418604
02/27/13 09:47
02/27/13 09:47
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
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.

Re: Super Signal [Re: jcl] #418605
02/27/13 10:28
02/27/13 10:28
Joined: Nov 2012
Posts: 209
S
SFF Offline OP
Member
SFF  Offline OP
Member
S

Joined: Nov 2012
Posts: 209
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;


Last edited by SFF; 02/27/13 10:33.
Re: Super Signal [Re: SFF] #418607
02/27/13 11:15
02/27/13 11:15
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
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.

Re: Super Signal [Re: jcl] #418610
02/27/13 11:31
02/27/13 11:31
Joined: Nov 2012
Posts: 209
S
SFF Offline OP
Member
SFF  Offline OP
Member
S

Joined: Nov 2012
Posts: 209
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);


Re: Super Signal [Re: SFF] #418611
02/27/13 11:42
02/27/13 11:42
Joined: Nov 2012
Posts: 209
S
SFF Offline OP
Member
SFF  Offline OP
Member
S

Joined: Nov 2012
Posts: 209
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();
}


Re: Super Signal [Re: SFF] #418614
02/27/13 12:53
02/27/13 12:53
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
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 ==.


Moderated by  Petra 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1