indiTraders - Forum for the Active Indian Trader  

Go Back   indiTraders - Forum for the Active Indian Trader > Tools > Software > Amibroker

DPonline
Reply
 
Bookmark and Share LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 20-11-2017, 10:02 PM
Sunshine's Avatar
Sunshine Sunshine is offline
indiTraders VIP
 
Join Date: Oct 2009
Posts: 2,665
Thanks: 6,486
Thanked 4,741 Times in 2,117 Posts
Sunshine has a reputation beyond repute
Sunshine has a reputation beyond reputeSunshine has a reputation beyond reputeSunshine has a reputation beyond reputeSunshine has a reputation beyond reputeSunshine has a reputation beyond reputeSunshine has a reputation beyond reputeSunshine has a reputation beyond reputeSunshine has a reputation beyond reputeSunshine has a reputation beyond reputeSunshine has a reputation beyond repute
Default AFL Programming Help

Started this thread to know the basic coding in AFLs . Please help .
If Mods think that this a redundant thread they can move the posts to old threads. .
Well , here is my first doubt .
How to write the following ?
Quote:
Day= Current Day (Today)
Opening bar = 9.15 Candle

2. How to make references to bars between 9.15 to 9.45

Thanks in advance to all
__________________
A man who moves a mountain begins by carrying away small stones - Confucius
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
The Following 3 Users Say Thank You to Sunshine For This Useful Post:
  #2 (permalink)  
Old 20-11-2017, 10:54 PM
no1lives4ever no1lives4ever is offline
Newbie
 
Join Date: Jul 2009
Posts: 3,574
Thanks: 22,330
Thanked 6,060 Times in 2,581 Posts
no1lives4ever has a reputation beyond repute
no1lives4ever has a reputation beyond reputeno1lives4ever has a reputation beyond reputeno1lives4ever has a reputation beyond reputeno1lives4ever has a reputation beyond reputeno1lives4ever has a reputation beyond reputeno1lives4ever has a reputation beyond reputeno1lives4ever has a reputation beyond reputeno1lives4ever has a reputation beyond reputeno1lives4ever has a reputation beyond reputeno1lives4ever has a reputation beyond reputeno1lives4ever has a reputation beyond reputeno1lives4ever has a reputation beyond reputeno1lives4ever has a reputation beyond repute
Default

Originally Posted by Sunshine View Post
Started this thread to know the basic coding in AFLs . Please help .
If Mods think that this a redundant thread they can move the posts to old threads. .
Well , here is my first doubt .
How to write the following ?


2. How to make references to bars between 9.15 to 9.45

Thanks in advance to all

You need to be more clear with a example on how you will use these references in code. As such your request makes no real sense to a afl coder.

-- no1lives4ever
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
The Following User Says Thank You to no1lives4ever For This Useful Post:
  #3 (permalink)  
Old 20-11-2017, 11:21 PM
asnavale asnavale is offline
indiTraders VIP
 
Join Date: Jun 2014
Posts: 437
Thanks: 889
Thanked 1,271 Times in 430 Posts
asnavale is a name known to allasnavale is a name known to allasnavale is a name known to allasnavale is a name known to allasnavale is a name known to allasnavale is a name known to allasnavale is a name known to allasnavale is a name known to allasnavale is a name known to allasnavale is a name known to allasnavale is a name known to all
Default

Originally Posted by Sunshine View Post
Started this thread to know the basic coding in AFLs . Please help .
If Mods think that this a redundant thread they can move the posts to old threads. .
Well , here is my first doubt .
How to write the following ?


2. How to make references to bars between 9.15 to 9.45

Thanks in advance to all

The first one is easy, (assuming the day's first candle is starting at 9:15)
Just write ValueWhen(Day() != Ref(Day(), -1), ....)
Here the .... refers to the value you want to refer to.

For the second part it depends on the time frame and the exact candle (in terms of time) you want to refer to. Also, it depends on how you have configured the candle timing in Ami broker. There are four options available in Tools-Preferences-Intraday. These options are:
1) the time of first tick in the bar
2) the time of last tick inside the bar
3) Start time of the interval
4) End time of the interval

Amibroker recommends option 3 where the start time of the interval is taken as candle time. If 9:15 is market opening time and time frame is 5min then the option 3 marks first candle of day as 9:15:00 to 9:19:59, second candle as 9:20:00 to 9:24:59 and so on. Option 4 labels first candle time as 09:15:01 to 09:20:00, second candle as 9:20:01 to 9:25:00 and so on.

Option 1 makes the exact time of first tick received in the time frame as candle time whereas Option 2 labels the exact time of the last tick received in the time frame as candle time.

So, it depends on exacly which candle you want to refer to. If your timeframe set to 5min and you want to refer to candle at 9:17 (in 1 min TF) then you need to use the TimeframeSet(...) and TimeframeRestore(...) commands and refer to the required candle within these commands. You may have to use a variable to define the time (like T = TimeNum()), and use this variable to access the desired candle.

If you can define your requirement more clearly, it is easy to give the code.

-Anant
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
The Following 4 Users Say Thank You to asnavale For This Useful Post:
  #4 (permalink)  
Old 26-11-2017, 10:44 AM
Sunshine's Avatar
Sunshine Sunshine is offline
indiTraders VIP
 
Join Date: Oct 2009
Posts: 2,665
Thanks: 6,486
Thanked 4,741 Times in 2,117 Posts
Sunshine has a reputation beyond repute
Sunshine has a reputation beyond reputeSunshine has a reputation beyond reputeSunshine has a reputation beyond reputeSunshine has a reputation beyond reputeSunshine has a reputation beyond reputeSunshine has a reputation beyond reputeSunshine has a reputation beyond reputeSunshine has a reputation beyond reputeSunshine has a reputation beyond reputeSunshine has a reputation beyond repute
Default

You are making me reveal my secret trading system

I found that in Ami it was End Time of Interval . Now I changed that to Start Time of Interval . So now it is showing the first bar as 9.15 .
The purpose is very simple .
1. If the first candle is a red candle Sell below the low of it and vice versa for Buy .
This system should work for 30 minutes and stop after that whether the trade takes place or not . that is why reference of the first bar as well as bars till 9.45 needed .
2.I want to plot Moving Avarage which start each day at 9,15 and not before that and end at the last bar of the day .
Hope I made myself clear .
__________________
A man who moves a mountain begins by carrying away small stones - Confucius
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
The Following User Says Thank You to Sunshine For This Useful Post:
  #5 (permalink)  
Old 26-11-2017, 10:57 AM
Sunshine's Avatar
Sunshine Sunshine is offline
indiTraders VIP
 
Join Date: Oct 2009
Posts: 2,665
Thanks: 6,486
Thanked 4,741 Times in 2,117 Posts
Sunshine has a reputation beyond repute
Sunshine has a reputation beyond reputeSunshine has a reputation beyond reputeSunshine has a reputation beyond reputeSunshine has a reputation beyond reputeSunshine has a reputation beyond reputeSunshine has a reputation beyond reputeSunshine has a reputation beyond reputeSunshine has a reputation beyond reputeSunshine has a reputation beyond reputeSunshine has a reputation beyond repute
Default

I am disappointed with Amibroker's Range Bars because it does not create phantom bars and big gaps are shown even in intraday . So I am trying to build range bars by using Plot OHLC function . I do not know whether it will work or not . It throws syntax error .
Please rectify and post the chart , if it works
Quote:
_SECTION_BEGIN("MyBar");
TickSize = 0.05;
MyBar = TickSize*10;
PlotOHLC(MyBar,"MyBar",styleBar|styleThick );
_SECTION_END("MyBar")

__________________
A man who moves a mountain begins by carrying away small stones - Confucius
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
The Following User Says Thank You to Sunshine For This Useful Post:
  #6 (permalink)  
Old 27-11-2017, 09:17 PM
no1lives4ever no1lives4ever is offline
Newbie
 
Join Date: Jul 2009
Posts: 3,574
Thanks: 22,330
Thanked 6,060 Times in 2,581 Posts
no1lives4ever has a reputation beyond repute
no1lives4ever has a reputation beyond reputeno1lives4ever has a reputation beyond reputeno1lives4ever has a reputation beyond reputeno1lives4ever has a reputation beyond reputeno1lives4ever has a reputation beyond reputeno1lives4ever has a reputation beyond reputeno1lives4ever has a reputation beyond reputeno1lives4ever has a reputation beyond reputeno1lives4ever has a reputation beyond reputeno1lives4ever has a reputation beyond reputeno1lives4ever has a reputation beyond reputeno1lives4ever has a reputation beyond reputeno1lives4ever has a reputation beyond repute
Default

Originally Posted by Sunshine View Post
I am disappointed with Amibroker's Range Bars because it does not create phantom bars and big gaps are shown even in intraday . So I am trying to build range bars by using Plot OHLC function . I do not know whether it will work or not . It throws syntax error .
Please rectify and post the chart , if it works

this is not how plotohlc works! At least understand the concept of plotohlc.

Making custom bars in Amibroker is not easy and is best not something that you as a beginner afl coder try to attempt!

-- no1lives4ever
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
The Following User Says Thank You to no1lives4ever For This Useful Post:
Reply

indiTraders - Forum for the Active Indian Trader > Tools > Software > Amibroker


Thread Tools
Display Modes

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 On
Refbacks are On


DPonline

All times are GMT +5.5. The time now is 08:31 PM.


vBulletin Copyright by vBulletin

Content Relevant URLs by vBSEO 3.3.2