Stock Portfolio Organizer

The ultimate porfolio management solution.

Shares, Margin, CFD's, Futures and Forex
EOD and Realtime
Dividends and Trust Distributions
And Much More ....
For Portfolio Manager Click Here

WiseTrader Toolbox

#1 Selling Amibroker Plugin featuring:

Advanced Adaptive Indicators
Advanced Pattern Exploration
Neural Networks
And Much More ....
Find Out More Here

Trade Once A Month for Amibroker (AFL)

Rating:
5 / 5 (Votes 1)
Tags:
amibroker

You can use this “switch code” to trigger a trade that will execute only once a month.

Indicator / Formula

Copy & Paste Friendly

This can be used as part of your trading system

/////Month Switch 

MonthCalc = Month();
newMonth = MonthCalc != Ref(Month(),-1);
monthswitch = 0;
monthswitcharray[0] = monthswitch[0];



for( j = 1; j < BarCount; j++ )
{
 
 monthswitch = monthswitcharray[j-1];
 
 
 if(newmonth[j] == 1)
 
 {
 
 monthswitch = 1; 
 
 }
 
 
 if (monthswitch == 0)
 
 
 {
 
 Buy[j] = 0;
 Short[j] =0;
 
 }
 
 
 
 if (Buy[j] OR Short[j]) 
 
 {
 
 monthswitch = 0;
 
 }
 
 
 monthswitcharray[j] = monthswitch;
 
 
 
 
 
}

2 comments

1. singhmen

No chart display from this code

2. sersev
/////Month Switch 
 
MonthCalc = Month();
newMonth = MonthCalc != Ref(Month(),-1);
monthswitch = 0;
monthswitcharray[0] = monthswitch[0];
 
 
 
for( j = 1; j < BarCount; j++ )
{
  
 monthswitch = monthswitcharray[j-1];
  
  
 if(newmonth[j] == 1)
  
 {
  
 monthswitch = 1; 
  
 }
  
  
 if (monthswitch == 0)
  
  
 {
  
 Buy[j] = 0;
 Short[j] =0;
  
 }
  
  
  
 if (Buy[j] OR Short[j]) 
  
 {
  
 monthswitch = 0;
  
 }
  
  
 monthswitcharray[j] = monthswitch;
  
  
  
  
  

Leave Comment

Please login here to leave a comment.

Back