Hello,

 >SellPrice = Ref(O, 1);

Wrong advice.
Once again: NEVER move trading prices using ref().

Instead delays SIGNALS
Buy = ref( Buy, -1 );
Sell = ref( Sell, -1 );


Best regards,
Tomasz Janeczko
amibroker.com

On 2010-04-21 00:54, hiscores wrote:
> There are numerous ways to do this, but here is a simple one
>
> Buy = C>  MA(C, 20);
> BuyPrice = C;
>
> StopLoss = C<  MA(C, 50);
> ProfitTarget = C>  MA(C, 10);
>
> Sell = StopLoss OR ProfitTarget;
> // If we exit due to stop loss take the 50 MA otherwise
> // by process of elimination we exit at target 10 MA
> SellPrice = iif(StopLoss, MA(C, 50), MA(C, 10));
>
> This is here so you can learn how to code such rules, but I should point out 
> that your strategy is unrealistic! You are making a rule where if at the END 
> of a bar we are below an MA we should sell at a price ABOVE the close (ie the 
> MA price that price action is now below). Furthermore the MA will not settle 
> to its final value until the bar is finished (since the MA is calculated on 
> closing prices). You should probably set your sell prices to the open of the 
> next bar
>
> SellPrice = Ref(O, 1);
>
> -hi
>
> --- In [email protected], "dralexchambers"<dralexchamb...@...>  wrote:
>    
>> Hi,
>>
>> How would I put together a backtest for the following. My Buy signal is:
>>
>> Buy = C>MA(C,20);
>>
>> How do I do a multiple sell signal for the following:
>>
>> StopLoss is hit is when C<  MA(C,50) Stoploss price is MA50. TakeProfit is 
>> when C>  MA(C,10), and TP price is MA10.
>>
>> I can only see one Sell&  Sellprice variable. How do I put both of these 
>> conditions into Sell&  Sellprice?
>>
>> Thanks,
>> Alex
>>
>>      
>
>
>
> ------------------------------------
>
> **** IMPORTANT PLEASE READ ****
> 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/
>
> Yahoo! Groups Links
>
>
>
>
>    

Reply via email to