Traderji.com - Discussion forum for Stocks Commodities & Forex

missing buy/sell variable assignments

Discuss missing buy/sell variable assignments at the AmiBroker within the Traderji.com - Discussion forum for Stocks Commodities & Forex; missing buy/sell variable assignments could someone help me I have written some basic codes Code: ...


Go Back   Traderji.com - Discussion forum for Stocks Commodities & Forex > TOOLS & RESOURCES > Software > AmiBroker

Notices


Advertise Here

Reply
 
Thread Tools
Sponsored Links
  #1  
Old 13th November 2006, 07:59 PM
Member
 
Join Date: Jan 2006
Posts: 109
Thanks: 1
Thanked 2 Times in 1 Post
Appreciation: 22
brijwanth is on a distinguished road
Default missing buy/sell variable assignments

missing buy/sell variable assignments

could someone help me I have written some basic codes

Code:
x="ref(close,0)";
for(i=1;i<5;i++)
  {
   "ref(close,-i)">x;
   x="ref(close,-i)";
  }
buy=x; 
sell=0;
this code is to buy of the closing price is decreasing from past 5 days

Pls. don't joke for this light code but this is first afl code

Also I have a small doubt whether we have to start with main() like in c or are their any rules like main in c etc

THANX IN ADVANCE
Reply With Quote
  #2  
Old 13th November 2006, 09:12 PM
Member
 
Join Date: May 2006
Location: Bangalore
Posts: 914
Thanks: 0
Thanked 1 Time in 1 Post
Appreciation: 33
bvpraveen is on a distinguished road
Default Re: missing buy/sell variable assignments

Quote:
Originally Posted by brijwanth View Post
missing buy/sell variable assignments

could someone help me I have written some basic codes

Code:
x="ref(close,0)";
for(i=1;i<5;i++)
  {
   "ref(close,-i)">x;
   x="ref(close,-i)";
  }
buy=x; 
sell=0;
this code is to buy of the closing price is decreasing from past 5 days

Pls. don't joke for this light code but this is first afl code

Also I have a small doubt whether we have to start with main() like in c or are their any rules like main in c etc

THANX IN ADVANCE
Hello Friend,

Please find the attached AFL which does your job exactly. It will display green buy arrow at the 5th bar. It can be used for any periods for lookback, ie 5 in your case. Let me know if anything is wrong or I've misunderstood your requirements.

If you want to either just change your code or need to use only Ref(), let me know. I will try it tomorrow.

No, we dont' need any C like main(). The AFL is executed from the first line.

Hope this helps,
Praveen.
Attached Files
File Type: txt 5 Lower Close.txt (779 Bytes, 53 views)
Reply With Quote
  #3  
Old 15th November 2006, 03:13 PM
Member
 
Join Date: Jan 2006
Posts: 109
Thanks: 1
Thanked 2 Times in 1 Post
Appreciation: 22
brijwanth is on a distinguished road
Default Re: missing buy/sell variable assignments

thanx but it gives
error 29
[code]
lowerCloseForming = True;

}
shape = Buy *
------------^
Error 29.
Variable 'buy' used without having been initialized.

}

/CODE]

Also I am studying Engg. II Yr so I have learnt c as one of my subject so I wanted to make simple easy to read code what are variables to initialise today's close and yesterday's close I din't want to chart but simply put in automatic analysis
one of the basic rules of trading is : KISS (KEEP IT SIMPLE, SIR !!!)
Thanx for ur reply

Last edited by brijwanth; 15th November 2006 at 03:30 PM.
Reply With Quote
  #4  
Old 15th November 2006, 04:37 PM
Member
 
Join Date: May 2006
Location: Bangalore
Posts: 914
Thanks: 0
Thanked 1 Time in 1 Post
Appreciation: 33
bvpraveen is on a distinguished road
Default Re: missing buy/sell variable assignments

Quote:
but it gives error 29
[code]
lowerCloseForming = True;

}
shape = Buy *
------------^
Error 29.
Variable 'buy' used without having been initialized.

}
I think this error would have occurred for those scripts that had less than 4 bars. Hence it might not have went into the 'for' loop. If its not the case, then please let me know. Better you initialize the buy variable to false in the beginning. ie insert this statement -- "Buy = false;" before the 'for' loop. That will solve this error.


Quote:
Also I am studying Engg. II Yr so I have learnt c as one of my subject so I wanted to make simple easy to read code
Friend, I too learnt C during my first year.

Quote:
what are variables to initialise today's close and yesterday's close I din't want to chart but simply put in automatic analysis
I couldn't get you, yar.

Today close -- Close[barCount]
Yesterday's close -- Close[barCount - 1]

If you are referring to any other question, please explain it clearly. I will try to answer.

Quote:
one of the basic rules of trading is : KISS (KEEP IT SIMPLE, SIR !!!)
Believe me, the AFL which I had given is not complex. Its simple only. I'd used some simple control statements. Thats it.

As usual, if I'd wrong anywhere, please let me know.

Hope this helps,
Praveen.
Reply With Quote
  #5  
Old 17th November 2006, 05:17 PM
Member
 
Join Date: Jan 2006
Posts: 109
Thanks: 1
Thanked 2 Times in 1 Post
Appreciation: 22
brijwanth is on a distinguished road
Default Re: missing buy/sell variable assignments

I meant to know the stocks which gave lost 10% in the past 5 days.

I want to put that program in automatic Analysis of Amibroker

issing buy/sell variable assignments this error repeats if i backtest and runs fine if i press scan

Last edited by brijwanth; 17th November 2006 at 05:51 PM.
Reply With Quote
  #6  
Old 17th November 2006, 06:09 PM
Member
 
Join Date: May 2006
Location: Bangalore
Posts: 914
Thanks: 0
Thanked 1 Time in 1 Post
Appreciation: 33
bvpraveen is on a distinguished road
Default Re: missing buy/sell variable assignments

Quote:
Originally Posted by brijwanth View Post
I meant to know the stocks which gave lost 10% in the past 5 days.

I want to put that program in automatic Analysis of Amibroker

issing buy/sell variable assignments this error repeats if i backtest and runs fine if i press scan
Hi,

For backtest, you need to specify when to buy and sell using 'Buy' and 'Sell' variables. Backtest wont work without these two variables.

The smallest AFL for backtest can be something like:

Quote:
Buy = Cross(MA(Close, 3), MA(Close, 13));
Sell = Cross(MA(Close, 13), MA(Close, 3));
In your case 'Buy' will be:

Quote:
Buy = C <= Ref(C, -5) * 0.9;
Define the condition for 'Sell' and then run Backtest. It should run now.

Praveen.
Reply With Quote
  #7  
Old 18th November 2006, 03:20 PM
Member
 
Join Date: Jan 2006
Posts: 109
Thanks: 1
Thanked 2 Times in 1 Post
Appreciation: 22
brijwanth is on a distinguished road
Default Re: missing buy/sell variable assignments

thanx praveen
Reply With Quote
Sponsored Links


Reply

Bookmarks


Advertise Here


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads for: missing buy/sell variable assignments
Thread Thread Starter Forum Replies Last Post
When to Buy? When to Sell? nkpanjiyar Equities 4 5th January 2008 05:35 AM
Did u buy or sell ?? Why eskay_raut Equities 4 4th July 2006 10:09 AM
SELL and BUY irfan Equities 8 31st October 2005 12:31 PM
MIA (Missing in Action) jaideep General Chit Chat 2 22nd August 2005 11:00 AM
Metastock - missing MACD histogram cmlee MetaStock 3 24th February 2005 09:24 PM


All times are GMT +5.5. The time now is 01:16 AM.

Indemnity, Disclaimer & Disclosure Notice:
• By visiting Traderji.com you indicate your acceptance of our Forum Rules Disclaimer & Disclosure and indemnify Traderji.com, its associates and related parties of all claims howsoever resulting from the usage of the forum.
Disclaimer: Trading or investing in stocks & commodities is a high risk activity. Any action you choose to take in the markets is totally your own responsibility. Traderji.com will not be liable for any, direct or indirect, consequential or incidental damages or loss arising out of the use of this information.
Disclosure: The information in this forum is neither an offer to sell nor solicitation to buy any of the securities mentioned herein. The writers may or may not be trading in the securities mentioned.
• All names or products mentioned are trademarks or registered trademarks of their respective owners.
General Content Disclaimer Notice:
In light of our policy of encouraging candid, open exchanges of views and the rapid distribution of information originating from many sources, Traderji.com cannot determine the accuracy of information that may be uploaded to the forum. Opinions, advice and all other information expressed by participants in discussions are those of the author. You rely on such information at your own risk. You are urged to seek professional advice for specific, individual situations and not rely solely on advice or opinions given in the discussions. Since Traderji.com is an open and free discussion forum, any comments made by members of this forum in their posts reflect their own views and not of the owner or administrator of Traderji.com. Thus the owner/administrator indemnify themselves of all claims whatsoever and will not be liable or responsible for any members comments/views in this forum Traderji.com. If you find any objectionable or offensive posts made by members of this forum which you would like to bring to our notice for removal then please Contact Us.
 


Copyright © 2001 - 2008, Traderji.com All Rights Reserved.

Recommended Websites - www.TradersEdgeIndia.com - www.TradingPicks.com - www.MasterOfTrading.com