I am having trouble trying to make this code to work. I'm trying to tell AB that if entry1 or entry2 triggers, the other one will be cancel and it will begin with the criteria that follows. In simple math, I would this to happen:
Assume LONG
if the Close crosses Entry1 or if entry 2 crosses the close, then begin:
Plot horizontal line for profit objective as RED
Plot horizontal line for risk as Blue
if Close crosses Risk , then go short.
I have the following code written but it is not doing what I want
////////////////////////////////////////////////////////////////
TradeOpenNumber = Param("1st Trade Open Number",0,0,1,.01);
ProfitTargetNumber = Param("Profit Target Number",0,0,2,.01);
RiskNumber = Param("Risk Number",0,0,2,.01);
TodayOpen = TimeFrameGetPrice( "O", inDaily, 0 );
entry1 = todayOpen + TradeOpenNumber ;
Long = Cross ( C, entry1) ;
entry2 = todayOpen - TradeOpenNumber ;
Short = Cross ( entry2, C ) ;
Sell1 = entry1 + ProfitTargetNumber;
Cover1 = entry2 - ProfitTargetNumber;
reverse_short = H - RiskNumber ; //round to lower 1/8
reverse_long = L + RiskNumber ; //round to higher 1/8
for( i = 1; i < BarCount; i++ ) {
if ( Long [i] == 1 OR Short [i] == 1 ) {
if ( Long [i] == 1 ) {
Plot ( Sell1, "Profit for Long", colorOrange, styleLine ) ;
Plot ( reverse_short, "Reversal", colorRed, styleLine ) ;
}
else {
Plot ( Cover1, "Profit for Short", colorBlue, styleLine ) ;
Plot ( reverse_long, "Reversal", colorGreen, styleLine ) ;
}
}
}
__._,_.___
Please note that this group is for discussion between users only.
To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
For other support material please check also:
http://www.amibroker.com/support.html
SPONSORED LINKS
| Investment management software | Real estate investment software | Investment property software |
| Software support | Real estate investment analysis software | Investment software |
YAHOO! GROUPS LINKS
- Visit your group "amibroker" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
