Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
2 registered members (AndrewAMD, TipmyPip), 12,709 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Scalping System #457223
01/06/16 21:42
01/06/16 21:42
Joined: Sep 2015
Posts: 5
C
carlmej Offline OP
Newbie
carlmej  Offline OP
Newbie
C

Joined: Sep 2015
Posts: 5
Hi all,

I'm trying to follow a strategy outlined on the following website: http://www.forexball.com/news/view/id/127.

Would anybody be able to take a look to ensure I have the logic right and suggest if any improvements could be made? (forgive me - it's my first attempt at writing a script). It makes a pretty consistent loss....
Quote:
function Scalp()
{
vars Price = series(price());
vars EMA100 = series(EMA(Price,100));
vars EMA50 = series(EMA(Price,50));
vars SOsc = series(Stoch(5,3,MAType_EMA,3,MAType_EMA));
int OscCrossUpp = 80;
int OscCrossLow = 20;
TakeProfit = PIP*7;
Stop = PIP*2;


if(crossUnder(SOsc,OscCrossUpp) && EMA50[0] < EMA100[0] && between(Price[0], EMA50[0],EMA100[0])){
Stop = PIP*3+EMA100[0]-Price[0];
enterShort();
}
else if(crossOver(SOsc,OscCrossLow) && EMA50[0] > EMA100[0] && between(Price[0], EMA100[0],EMA50[0])){
Stop = PIP*3-EMA100[0]+Price[0];
enterLong();
}
}

function run()
{
BarPeriod = 1;
LookBack = 140;
StartDate = 2009;
Spread = 0.2*PIP;

Scalp();

}

Re: Scalping System [Re: carlmej] #457228
01/07/16 12:56
01/07/16 12:56
Joined: Feb 2015
Posts: 652
Milano, Italy
M
MatPed Offline
User
MatPed  Offline
User
M

Joined: Feb 2015
Posts: 652
Milano, Italy
I am not a code guru, but you code looks correct, but in order to test a 1 Min strategy I would use ticks data and set the ticks flag.

Ciao

Re: Scalping System [Re: MatPed] #457232
01/07/16 21:40
01/07/16 21:40
Joined: Sep 2015
Posts: 5
C
carlmej Offline OP
Newbie
carlmej  Offline OP
Newbie
C

Joined: Sep 2015
Posts: 5
Thanks very much for the feedback.

I've tried to look at the ticks flag and tick() function (struggling to get my head around the purpose of TMFs and AssetVar). Would I be correct in thinking that as a series can't be defined within a tick function I would be using it to determine the current price at each tick thus triggering the TP?

The amendment I've made reduces the losses by 5% - I think testing at this level going struggle with slippage. Hope this isn't too messy:
Quote:

function Scalp()
{
vars Price = series(price());
vars EMA100 = series(EMA(Price,100));
vars EMA50 = series(EMA(Price,50));
vars SOsc = series(Stoch(5,3,MAType_EMA,3,MAType_EMA));
int OscCrossUpp = 80;
int OscCrossLow = 20;
TakeProfit = PIP*7;
Stop = PIP*2;


if(crossUnder(SOsc,OscCrossUpp) && EMA50[0] < EMA100[0] && between(Price[0], EMA50[0],EMA100[0])){
Stop = PIP*3+EMA100[0]-Price[0];
enterShort();
AssetVar[1] = Price[0];
}
else if(crossOver(SOsc,OscCrossLow) && EMA50[0] > EMA100[0] && between(Price[0], EMA100[0],EMA50[0])){
Stop = PIP*3-EMA100[0]+Price[0];
AssetVar[1] = Price[0];
enterLong();
}
}


var CurrentPrice()
{ var Price = price();
return Price;
}

function tick()
{
AssetVar[0] = CurrentPrice();
if(AssetVar[0] <= AssetVar[1]-TakeProfit)
exitShort();
if(AssetVar[0] >= AssetVar[1]+TakeProfit)
exitLong();
//Scalp();
}

function run()
{
set(TICKS); //4234
BarPeriod = 1;
LookBack = 140;
StartDate = 2009;
Spread = 0.2*PIP;

Scalp();

}


I might try optimizing the SL and TP, see if that helps.


Moderated by  Petra 

Gamestudio download | 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