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

Re: [amibroker] Loop help please!



PureBytes Links

Trading Reference Links

I'm not taking the value returned, just assigning an alias to the function so I don't have 
to keep writing out the long form. Or that is what I think I'm doing.
The following works, with all Stops disabled under the Settings tab.
Buy = your entry signal;
loss = ApplyStop(stopTypeLoss, stopModePoint,Optimize( "max. loss stop level", 0.01, 
0.001, 0.01, 0.0005 ), 1,True,1 );
profit = ApplyStop(stopTypeProfit, stopModePoint,Optimize( "max. profit stop level", 
0.002, 0.001, 0.015, 0.0005 ), 1,True );
Sell = iiF(loss,loss,profit) ;
Buy=ExRem(Buy,Sell);




----- Original Message ----- 
From: "iceberg_grognon" <iceberg_grognon@xxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Sunday, November 07, 2004 6:59 AM
Subject: [trading] Re: [amibroker] Loop help please!


>
>
> Well, for one thing, AFAIK, you cannot have :
>
> profit = ApplyStop(stopTypeProfit, stopModePoint,Optimize( "max.
> profit stop level",
>> > 0.002, 0.001, 0.015, 0.0005 ), 1,True );
>
> From the user manual:
>
> Applystop is a function that returns nothing. It controls built in
> stops at the formula level.
>
>
>
>
> --- In amibroker@xxxxxxxxxxxxxxx, "Beachie" <beachie41@xxxx> wrote:
>> No one?
>>
>> ----- Original Message ----- 
>> From: "Beachie" <beachie41@xxxx>
>> 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;
>> >



------------------------ 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/