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

Re: [EquisMetaStock Group] Re: Carrying Target



PureBytes Links

Trading Reference Links

Hi Abo


Use Cum("MySignal")=1 AND "MySignal" to capture the first event. I'm not clear which is the signal you're trying to capture the first occurrence of, but there are some things to watch out for or you'll shoot yourself in the foot. Using Cross() in a series of variables will generate additional N/A bars from those variables, and that can make capturing the first event of anything rather precarious. Your Cross(Mov(CLOSE,9,E),Mov(CLOSE,21,S)); should only be defined once, then that variable used instead of repeating the expression and incorporating an extra N/A plot (an unwanted "feature" of the Cross() function).

Once everything that's likely to add an N/A bar has been defined you can create an "Initialisation" variable which can be used by subsequent code to inform you all variables are defined and stable. An "Init" variable is more or less the same concept as the IsDefined() function, but more useful in my opinion.

Using Cross() in Trigger is not a good idea because that immediately adds another N/A bar (N/A bars are cumulative), and I notice you're using Ref() in Signal - another N/A bar generated there I'm afraid.

You can overcome the problem of Ref() generating an N/A bar by substituting ValueWhen(2,1,Trigger) for Ref(Trigger,-1).

The point is that unless all your essential variables start on the same bar, and as early as possible, you really have no control over what is happening around the start of your indicator.

Init:=Cum(Isdefined(Trend+StartTrend+Trigger))=1;
Signal:=Trend AND Trigger AND BarsSince(Init OR ValueWhen(2,1,Trigger)) > BarsSince(Init OR StartTrend);

Hope this gives you some ideas.


Regards

Roy
www.metastocktips.co.nz



 
----- Original Message ----- 
From: Abo Faisal 
To: equismetastock@xxxxxxxxxxxxxxx 
Sent: Thursday, February 02, 2006 1:14 PM
Subject: Re: [EquisMetaStock Group] Re: Carrying Target


Hi
  I wrote this code...
  To catch the first time i hit my goal (which is as an example if the close is 5% more first time siince the signal buy);;
  Trend := Mov(C,9,E) > Mov(C,21,S);
StartTrend := Trend AND Cross(Mov(CLOSE,9,E),Mov(CLOSE,21,S));
MyGoal:=ValueWhen(1, Cross(Mov(CLOSE,9,E),Mov(CLOSE,21,S)),C*1.05);
Trigger:=Cross(H,MyGoal); 
Signal:= Trend AND Trigger AND BarsSince(Ref(Trigger,-1)) > BarsSince(StartTrend);
Signal;
  It works fine except for for all the chart except first time,,,,
  Any idea?
Abo Faisal <isuisu2222@xxxxxxxxx> wrote:
    Hi
  Thanks
  What i can do to plot target achived only when i hit the target at the first time? if the condition is applied next day or later i do not want to plot. This logic will keep ploting every time ,,
  Any smart idea?

Jose Silva <josesilva22@xxxxxxxxx> wrote:
  Majed, use the MS indicator below as a basis for you target 
conditions.

========
Target %
========
---8<--------------------------

{ Target based on SMA crossover signals.

©Copyright 2006 Jose Silva.
  For personal use only.
  http://www.metastocktools.com }

{ User inputs }
pr:=Input("Target %",-100,100,5);
pds1:=Input("SMA 1 periods",1,260,5);
pds2:=Input("SMA 2 periods",2,2600,21);
plot:=Input("plot:  [1]Target,  [2]Signals",
1,2,1);

{ SMAs }
sma1:=Mov(C,pds1,S);
sma2:=Mov(C,pds2,S);

{ Crossover signal }
entry:=Cross(sma1,sma2);

{ Signal's Close }
entryVal:=ValueWhen(1,entry,C);

{ Target }
target:=entryVal*(1+pr/100);

{ Taget breach signal }
exit:=Cross(C,target);

{ Plot target on price chart }
If(plot=1,target,entry-exit)

---8<--------------------------


> Also what will happen if i have multiple targets?

You will be confused.


jose '-)
http://www.metastocktools.com




--- In equismetastock@xxxxxxxxxxxxxxx, Abo Faisal <isuisu2222@xxxx> 
wrote:
>
> Hello
>   I need your help guys, thanks in advance..
>   i'm calculating a price profit target based on mat calculation
> after two moving averages crossed each other. Now i'd like to check
> if any future price match this price profit target, how and where
> can i save the target? how can i access in future.
>   Example:
>   at 1-1-2006 a 10 moving average crossed the 50 MA and i decided
> that the proift target will be the close price*1.15, for example.
> how can i in future find this target so i can compare it with
> current close price? Also what will happen if i have multiple
> targets?
>    
>   Thanks
>   Majed









  SPONSORED LINKS 
        Business finance course   Business to business finance   Small business finance     Business finance consultant   Business finance magazine   Business finance schools 
    
---------------------------------
  YAHOO! GROUPS LINKS 

    
    Visit your group "equismetastock" on the web.
    
    To unsubscribe from this group, send an email to:
equismetastock-unsubscribe@xxxxxxxxxxxxxxx
    
    Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 

    
---------------------------------
  

  

    
---------------------------------
  Bring words and photos together (easily) with
PhotoMail - it's free and works with Yahoo! Mail.  


            
---------------------------------

What are the most popular cars? Find out at Yahoo! Autos 

[Non-text portions of this message have been removed]





SPONSORED LINKS Business finance course  Business to business finance  Small business finance  
      Business finance consultant  Business finance magazine  Business finance schools  


--------------------------------------------------------------------------------
YAHOO! GROUPS LINKS 

  a..  Visit your group "equismetastock" on the web.
    
  b..  To unsubscribe from this group, send an email to:
   equismetastock-unsubscribe@xxxxxxxxxxxxxxx
    
  c..  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 


--------------------------------------------------------------------------------



[Non-text portions of this message have been removed]



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Try Online Currency Trading with GFT. Free 50K Demo. Trade 
24 Hours. Commission-Free. 
http://us.click.yahoo.com/RvFikB/9M2KAA/U1CZAA/BefplB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

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

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

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