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 (RealSerious3D, AndrewAMD, chsmac85, dr_panther, TedMar), 942 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Conditions on two different time frames #422632
05/13/13 22:13
05/13/13 22:13
Joined: Nov 2012
Posts: 19
Texas, US
D
deweymcg Offline OP
Newbie
deweymcg  Offline OP
Newbie
D

Joined: Nov 2012
Posts: 19
Texas, US
Sorry to be such a newb. I am trying to write a script that will first check the Daily Close from yesterday and see if it is above both the EAM 50 and EMA 20. If it is in between, do nothing. If it is above, then look at the 1 hour time frame and enter a long if the Williams%R goes below -80. If it is below the EMA's then go short if on the 1 hour time frame the Williams%R goes above -20.

I will add a few more conditions once I get this part figured out. I keep getting errors and am not sure where I am screwing up:

function run()
{
BarPeriod = 60;


TimeFrame = 24;

vars DailyClose = series(priceClose(1));
vars EMA50 = series(EMA(DailyClose,50));
vars EMA20 = series(EMA(DailyClose,20));

TimeFrame = 1;

Stop = 6.5*ATR(30);
TakeProfit = 9*ATR(30);


if ((DailyClose > EMA50) and (DailyClose > EMA20)
and (WillR(14) < -80))

enterLong();


else if ((DailyClose < EMA50) and (DailyClose < EMA20)
and (WillR(14) > -20))

enterShort();

}

Please have a look and point me in the right direction.

Re: Conditions on two different time frames [Re: deweymcg] #422633
05/14/13 00:31
05/14/13 00:31
Joined: Sep 2012
Posts: 99
T
TankWolf Offline
Junior Member
TankWolf  Offline
Junior Member
T

Joined: Sep 2012
Posts: 99
Originally Posted By: "Code"

function run()
{
BarPeriod = 60;
LookBack = 100;

TimeFrame = 24;
vars DailyClose = series(priceClose());
vars EMA50 = series(EMA(DailyClose,50));
vars EMA20 = series(EMA(DailyClose,20));

TimeFrame = 1;
Stop = 6.5*ATR(30);
TakeProfit = 9*ATR(30);

if ((*DailyClose > *EMA50) and (*DailyClose > *EMA20)
and (WillR(14) < -80))
enterLong();
else if ((*DailyClose < *EMA50) and (*DailyClose < *EMA20)
and (WillR(14) > -20))
enterShort();
}


For comparing a variable that is the target of the pointer, add a '*' to the pointer name, just as in the pointer definition. This way the variable can be directly read.

Hope this helps.

Re: Conditions on two different time frames [Re: TankWolf] #422635
05/14/13 00:46
05/14/13 00:46
Joined: Nov 2012
Posts: 19
Texas, US
D
deweymcg Offline OP
Newbie
deweymcg  Offline OP
Newbie
D

Joined: Nov 2012
Posts: 19
Texas, US
Thanks!


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