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

Re: [amibroker] Re: forex - mini lots



PureBytes Links

Trading Reference Links

ozzyapeman wrote:
Actually I do use Applystop()in a good number of my formulas. Any
suggestions for such cases?

  
That is what I came out with  (OHLC build on Bid price):


SetCustomBacktestProc( "" );
if ( Status( "action" ) == actionPortfolio )
{
    bo =
GetBacktesterObject();
    bo.PreProcess();
    slipage =
TickSize;
    spread =
2 * TickSize;
   
    
for ( bar = 0; bar < BarCount; bar++ )
    {
        
for ( sig = bo.GetFirstSignal(bar); sig; sig = bo.GetNextSignal(bar) )
        {
         symbol = sig.symbol;
         hi =
Foreign(symbol, "H");
         lo =
Foreign(symbol, "L");
         
          
if ( sig.IsExit() )
            {
            
if ( sig.isLong)
            {
               realexitprice = sig.price - slipage;
               
if( realexitprice >= lo[bar] && realexitprice <= hi[bar])
               {
                  sig.price = realexitprice;
                  bo.ExitTrade(bar,sig.symbol,sig.Price);  
// I'm not sure if it is needed
               }
               
else
               sig.price = -
1;
            }
            
else
            {
               realexitprice = sig.price + slipage;
               
if ( realexitPrice >= lo[bar]+ 0.5*spread && realexitprice <= hi[bar]+0.5*spread)
               {
                  sig.price = realexitprice;
                  bo.ExitTrade(bar,sig.symbol,sig.Price);
// I'm not sure if it is needed
               }
               
else
               sig.price = -
1;
            }

            }
        }

        bo.ProcessTradeSignals( bar );
    }

    bo.PostProcess();
}

__._,_.___

**** IMPORTANT ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

*********************
TO GET TECHNICAL SUPPORT from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
*********************

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html

*********************************




Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___