I expert,
In the formula below, I’m use in the function NEXTPEAK
A lot of IIf
If I’m use " FOR " the formula are to short ?
How write it ?
Thanks
Autotrade
---------------------------------
_SECTION_BEGIN_SECTION_BEGIN("Search Next Peak More Higher");
function ValPk(Size,P1)
{
Prix=LastValue(Peak(C,Size,P1));
return Prix ;
}
function NextPeak(Size,P1)
{
P1= ValPk(10,1) ;
P2= IIf( P1< ValPk(10,2),2, IIf( P1< ValPk(10,3),3,
IIf( P1< ValPk(10,4),4, IIf( P1< ValPk(10,5),5,
IIf( P1< ValPk(10,6),6, IIf( P1< ValPk(10,7),3,
IIf( P1< ValPk(10,8),8, IIf( P1< ValPk(10,9),9,
IIf( P1< ValPk(10,10),10, IIf( P1< ValPk(10,11),11,
IIf( P1< ValPk(10,12),12, IIf( P1< ValPk(10,13),13,
IIf( P1< ValPk(10,14),14, IIf( P1< ValPk(10,15),5,
IIf( P1< ValPk(10,16),16, IIf( P1< ValPk(10,17),3,
IIf( P1< ValPk(10,18),18, IIf( P1< ValPk(10,19),9,
IIf( P1< ValPk(10,20),20, 0 ))))))))))))))))))) ;
return P2 ;
}
P1= ValPk(10,1) ;
P2= ValPk(10,NextPeak(10,1)) ;
Plot(P1,"P1",colorBlue,styleThick) ;
Plot(P2,"P2",colorBlack,styleThick) ;
_SECTION_END();function ValPk(Size,P1)
{
Prix=LastValue(Peak(C,Size,P1));
return Prix ;
}
function NextPeak(Size,P1)
{
P1= ValPk(10,1) ;
P2= IIf( P1< ValPk(10,2),2, IIf( P1< ValPk(10,3),3,
IIf( P1< ValPk(10,4),4, IIf( P1< ValPk(10,5),5,
IIf( P1< ValPk(10,6),6, IIf( P1< ValPk(10,7),3,
IIf( P1< ValPk(10,8),8, IIf( P1< ValPk(10,9),9,
IIf( P1< ValPk(10,10),10, IIf( P1< ValPk(10,11),11,
IIf( P1< ValPk(10,12),12, IIf( P1< ValPk(10,13),13,
IIf( P1< ValPk(10,14),14, IIf( P1< ValPk(10,15),5,
IIf( P1< ValPk(10,16),16, IIf( P1< ValPk(10,17),3,
IIf( P1< ValPk(10,18),18, IIf( P1< ValPk(10,19),9,
IIf( P1< ValPk(10,20),20, 0 ))))))))))))))))))) ;
return P2 ;
}
P1= ValPk(10,1) ;
P2= ValPk(10,NextPeak(10,1)) ;
Plot(P1,"P1",colorBlue,styleThick) ;
Plot(P2,"P2",colorBlack,styleThick) ;
_SECTION_END();
Posted by: "Autotrade" <autotrade@videotron.ca>
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (1) |
This group is for the discussion between users only.
This is *NOT* technical support channel.
TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com
TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
EmoticonEmoticon