Quick gander

#46739

Steven
  • Topics: 5
  • Replies: 5
  • Posts: 10

Quick gander

Hi Colin

 

I’m “newish” to scripting but thought as a test I’d have a look.

 

Breaking it down and re-creating it, letting Optuma identify variables rather than typing them in (and commenting out line by line to see which it would allow me to comment out (as they all should be commentable I believe) and I got it valid. Hope it helps…

 

DPco = OPEN() – CLOSE();

DPoc = CLOSE()-OPEN();

DPhh = HIGH()-HIGH()[1];

DPll = LOW()-LOW()[1];

DPhl = (HIGH()-LOW())*(((CLOSE()-LOW())/(HIGH()-LOW())) – 0.5);

 

DPtot = DPco + DPoc + DPhh + DPll + DPhl;

PrevDPtot = DPtot[1];

 

DD2P = DPtot – PrevDPtot;

 

DD2P

 

TRADING = SWITCH( (DPtot > 0) and (D2P > 0) and (OFFSET(D2P, OFFSET=1) > 0), (DPtot <= 0) );

 

BUYPRICE = IF( TRADING, (IF(OFFSET(TRADING, OFFSET=1) , BUYPRICE, ( (close() + open() + high() + low())/4.0) ) ), 0);

SELLPRICE = IF( TRADING, 0, (IF(OFFSET(TRADING, OFFSET=1), ( (CLOSE() + OPEN() + HIGH() + LOW())/4.0 ), 0) ));

 

Cond3 = BUYPRICE;

Cond2 = SELLPRICE;

Cond4 = (Cond2-Cond3);

Cond1 = IF(OFFSET(TRADING, OFFSET=1), Cond4, 0);

THISPROFIT = IF (TRADING, 0, Cond1);

 

TOTPROFIT = TOTPROFIT[1] + THISPROFIT;

 

TOTPROFIT

 

 

Pin It on Pinterest

Share This

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close