[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Re: Monte Carlo-based Optimization?



PureBytes Links

Trading Reference Links

Hello,

The problem is due to the line:
DTI = IIf((Value5 =! 0), Value4 / Value5, 0); 

You see you have writen

Value =! 0

Note that there is NO =! operator.  Correct inequality check is !=  (it reads NOT EQUAL, not vice versa)
If you write Value =! 0 it means:

Value =  ! 0

! is logical not. ! 0 is (NOT FALSE) = TRUE = 1

So it evaluates to 
Value = 1

Assign 1 to value

Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message ----- 
From: "Nurudin Kaba" <n.kaba@xxxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Monday, July 26, 2004 8:20 AM
Subject: [amibroker] Function related question....


> i'm confused ...which isn't really new... :-)  but here goes...
> 
> the following is an indicator i'm working on.
> 
> 
> 
> function TXAverage(Price,Value1,Value2,Value3)
> {
> Temp1 = EMA( EMA (EMA (Price,Value1), Value2), Value3);
> return Temp1;
> }
> //
> //Variables
> //
> r = 14; s = 10; u1 = 5; u2 = 6;
> //
> //
> HMU = IIf(((H - Ref(H,-1)) > 0), (H - Ref(H,-1)), 0 );
> LMD = IIf(((L - Ref(L,-1)) < 0), (-(L - Ref(L, -1))), 0 );
> //
> //
> Value4 = (TXAverage((HMU - LMD), r, s, u1) * 100);
> Value5 = (TXAverage(abs(HMU - LMD), s, r, u1) );
> Value5a = EMA(EMA(EMA(abs(HMU - LMD),s),r),u1);
> //
> DTI = IIf((Value5 =! 0), Value4 / Value5, 0);
> //
> Plot(HMU,"HMU",colorBlack,styleLine);
> Plot(LMD,"LMD",colorRed,styleLine);
> Plot(Value4,"Value4",colorBlue,styleLine);
> Plot(Value5,"Value5",colorGreen,styleLine);
> 
> Plot(DTI,"DTI",colorYellow,styleLine);
> 
> 
> My question is why does the second call(Value5) to the TXAverage function
> result in the value 1.00 when Value5a which is essentially the same gives me
> the right answer and Value5 gives me 1.00  The function works when called
> for Value4 but not for Value5.
> 
> Thanks a bunch...
> Nurudin
> 
> PS
> using v4.60.0beta, win 2000 pro sp4
> 
> Thanks again.
> 
> 
> 
> 
> 
> 
> Check AmiBroker web page at:
> http://www.amibroker.com/
> 
> Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
> Yahoo! Groups Links
> 
> 
> 
>  
> 
>


------------------------ Yahoo! Groups Sponsor --------------------~--> 
Yahoo! Domains - Claim yours for only $14.70
http://us.click.yahoo.com/Z1wmxD/DREIAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/