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

Re: [amibroker] Loop help please!



PureBytes Links

Trading Reference Links

......and here's me thinking it was crystal clear :)
Ok, so what I'm trying to do is:
Entry is on "Open, Delay 1" after the trigger which is "Ref(H,-2) > Ref(H,-3) AND 
Ref(H,-3) > Ref(H,-4)"
There are 2 sell options:
Use the built in "StopmodeProfit"  or sell if close of bar is x.xxx amount below the entry 
bar low

Loop through the code testing each buy/sell signal.

thanks


----- Original Message ----- 
From: "ed nl" <ed2000nl@xxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Sunday, November 07, 2004 6:54 AM
Subject: Re: [trading] Re: [amibroker] Loop help please!


>
> maybe try to ask a clear question first. Your code makes no sense at all. Maybe try to 
> explain in 3 lines what you want to do. Your code makes no sense. If people see it they 
> just move on. Really, I don't even know what the question is....
>
> ed
>
>
>  ----- Original Message ----- 
>  From: Beachie
>  To: amibroker@xxxxxxxxxxxxxxx
>  Sent: Saturday, November 06, 2004 8:45 PM
>  Subject: Re: [trading] Re: [amibroker] Loop help please!
>
>
>  No one?
>
>  ----- Original Message ----- 
>  From: "Beachie" <beachie41@xxxxxxxxxxx>
>  To: <amibroker@xxxxxxxxxxxxxxx>
>  Sent: Saturday, November 06, 2004 11:45 PM
>  Subject: [trading] Re: [amibroker] Loop help please!
>
>
>  >
>  > OK, even my jellied brain saw the logic flaw in the previous pseudo code re:
>  > Valuewhen(Buy
>  > etc etc). Have corrected.
>  >
>  >
>  >
>  > trig= Ref(H,-2) > Ref(H,-3) AND Ref(H,-3) > Ref(H,-4) ;//AND Ref(L,-2) >= Ref(L,-3) 
> AND
>  > Ref(L,-3) >= Ref(L,-4)
>  >
>  > sl = Optimize("sl", 0.006, 0.001, 0.015, 0.0005);
>  >
>  > profit = ApplyStop(stopTypeProfit, stopModePoint,Optimize( "max. profit stop level",
>  > 0.002, 0.001, 0.015, 0.0005 ), 1,True );
>  >
>  > profit = 0;
>  >
>  > BuyPrice= 0;
>  >
>  > Sellstop = 0;
>  >
>  > Buy = trig;
>  >
>  > for( i = 0; i < BarCount; i++ )
>  >
>  > {
>  >
>  > if( BuyPrice == 0 && Buy[ i ] == 1 ) // A buy is signalled
>  >
>  > BuyPrice = Open[i+1] ; // read *next* value of array after buy signal to get the "Buy 
> on
>  > open, delay 1 " value
>  >
>  > Low_of_entrybar = Low[i+1] - sl; //entry bar low value minus the 0.00x filter
>  >
>  > Sellstop = Cross(Low-Of_entrybar,C); //sell if close less then Low_of_entrybar value
>  >
>  >
>  > if(Sellstop == 1 OR profit == 1) // test to see if either a sellstop or profit stop
>  > value
>  > true
>  >
>  > {
>  >
>  > Sell [i] =1;
>  >
>  > SellPrice[i] = IIf(Sellstop,ValueWhen(Cross(Low-Of_entrybar,L), profit); //choose 
> which
>  > value to assign to Sellprice
>  >
>  > Sellstop = 0; //reset values to 0
>  >
>  > BuyPrice = 0;
>  >
>  > }
>  >
>  > else
>  >
>  > Sell[i] = 0;
>  >
>  >
>  >
>  > ----- Original Message ----- 
>  > From: "Beachie" <beachie41@xxxxxxxxxxx>
>  >
>  >>
>  >> OK,
>  >>
>  >> have kept at it, but just can't get my head around it. Below is the pseudo code as 
> my
>  >> logic sees it. Obviously it doesn't work. Help appreciated.
>  >>
>  >> trig= Ref(H,-2) > Ref(H,-3) AND Ref(H,-3) > Ref(H,-4) ;//AND Ref(L,-2) >= Ref(L,-3) 
> AND
>  >> Ref(L,-3) >= Ref(L,-4)
>  >>
>  >> sl = Optimize("sl", 0.006, 0.001, 0.015, 0.0005);
>  >>
>  >> profit = ApplyStop(stopTypeProfit, stopModePoint,Optimize( "max. profit stop level",
>  >> 0.002, 0.001, 0.015, 0.0005 ), 1,True );
>  >>
>  >> profit = 0;
>  >>
>  >> BuyPrice= 0;
>  >>
>  >> Sellstop = 0;
>  >>
>  >> Buy = trig;
>  >>
>  >> for( i = 0; i < BarCount; i++ )
>  >>
>  >> {
>  >>
>  >> if( BuyPrice == 0 && Buy[ i ] == 1 ) // A buy is signalled
>  >>
>  >> BuyPrice = ValueWhen(Buy[i+1],O); // read *next* value of array after buy signal to 
> get
>  >> the "Buy on open, delay 1 " value
>  >>
>  >> Low_of_entrybar = ValueWhen(Buy [i+1], L) - sl; //entry bar low value minus the 
> 0.00x
>  >> filter
>  >>
>  >> Sellstop = Cross(Low-Of_entrybar,C); //sell if close less then Low_of_entrybar value
>  >>
>  >>
>  >> if(Sellstop == 1 OR profit == 1) // test to see if either a seelstop or profit stop
>  >> value true
>  >>
>  >> {
>  >>
>  >> Sell [i] =1;
>  >>
>  >> SellPrice[i] = IIf(Sellstop,ValueWhen(Cross(Low-Of_entrybar,L), profit); //choose 
> which
>  >> value to assign to Sellprice
>  >>
>  >> Sellstop = 0; //reset values to 0
>  >>
>  >> BuyPrice = 0;
>  >>
>  >> }
>  >>
>  >> else
>  >>
>  >> Sell[i] = 0;
>  >>
>  >> }
>



------------------------ Yahoo! Groups Sponsor --------------------~--> 
$9.95 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/J8kdrA/y20IAA/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/