Topic: Some basic questions

Apologies if this informateion is posted elsewhere but I haven't been able to find it.

I've just started playing with FSB, and have some queries.

1. I can't create a data file in the correct format it seems. I assume from the instructions that the date format is controlled by the separater (hyphen for yy/mm/dd, period for dd/mm/yy and slash for mm/dd/yy) but no amount of fiddling in Excel or Notepad has given me a valid file. Particularly confusing for me as here in Oz the default is the British format, dd/mm/yy, which is apparently not supported.

2. The doc also says that space, tab and comma are acceptable data separators, but tab seems to be the only thing that works. Manipulating tabs in Notepad is basically impossible.

3. I tried saving data from MetaTrader, but I am using MT5 and the format seems to have changed slightly. The file name now uses M1, M5, D1 etc instead of the number of minutes. The format also seems to be not compatible with FSB as noted above. When I try to load it I get a "could not count the data bars" error. Perhaps this is due to incorrect date format? Also, MT5 does not insert tabs into the file created, only a comma, and the date and time only have a space separator.

4. It appears that indicators are coded in a proprietary FSB format, and there appears to be no way to import indicators developed for MT4 or MT5 into FSB, or back the other way if it comes to that. Is this correct? If so then FSB's usefulness is severely limited. I have two indicators written for MT5 that I designed and as far as I know are not being used by anybody else. How can I backtest in FSB using my indicators? Do I have to have my indicators recoded into FSB format? Also there are many indicators written for both MT4 and MT5 that do not appear in FSB. Presumably none of thes indicators can be (easily) used in FSB either?

5. I have seen in other posts that apparently FSB cannot access bar information other than the current' bar it is processing. Is this correct? My indicators rely on a series of events occurring over a set of up to 30 bars. If FSB cannot access prior bar information then it seems my indicators could not be transferred to FSB even if I wanted them to be.

6. In several places I have noted the comment that trades can be transferred to MT4. I assume this means that FSB and MT4 can communicate with each other, and that FSB can trigger MT4 to enter trades (presumably via an EA, but I haven't really delverd into that yet). Is this correct? Are there any plans afoot to support MT5 as well?

Thanks for your patience and time. I appreciate I have asked a lot of questions here, and maybe some of the answers are contained in the documentation or forum posts, but I have not been able to find any direct answers to these issues. I really appreciate all assistance and responses.

Thanks in advance,
Ian

Re: Some basic questions

6. Communicating with FSB:
That is the other program, Forex Strategy Trader. Take the strategy developed and backtested in FSB, then copy to Forex Strategy Trader (FST), then FST connects to MT4 to automate executing the strategy.
I'm not sure abut MT 5, there may be some posts in the News forum.

Re: Some basic questions

4. Indicator coding between MT4 and FSB:
that is correct, FSB indicators have their own coding, different from MT4. MT4 indicators have to be ported to FSB. FSB is in C#. With some patience, it can be done, the FSB coding can be learned fairly quickly, usually it's just trying to figure out how to use arrays and floats and integer for bar number to do the same thing between the 2.

Re: Some basic questions

5. accessing other bar's info:
With some coding I'm fairly sure this can be done. Most of the indicators are a value based on the price (ex, RSI, macd, etc) and the logic looks for when the value rises, falls, is higher than a level or crosses it. I think what you would do would be code as: if value crosses an important point, present a flag for the next 30 ( or 10 or n bars); or, search the previous 30 bars for the important point.

Re: Some basic questions

Let me help you out big time

-Using the find and replace function in notepad is the KEY

-Also remember you can copy and paste to and from excel and notepad

-But the key thing to remember is YOU CAN COPY AND PASTE TABS in notepad it shows up as a square or invalid character

-Open up a data that is already used in the program and copy its format exactly including changing all the years from /2011 to /11

Save the finished data from notepad, change the file type to "All Files" from "Text Documents" and add a ".csv" at the end of the name

No decimal places aloud in the volume field

Open data in notpad and copy to excel, then change the OPEN CLOSE HIGH LOW to match the programs data files then copy back to notepad and use the Find/Replace Function.

Re: Some basic questions

Thanks krog and mixmanmatt, appreciate the responses.

Mixmanmatt, are you using Win7? I am, and in my version of Notepad tabs are handled "correctly", i.e. displayed as white space, not little boxes (I'm pretty sure that was the case with XP, but I havent' used it for a while), you are right though, it is possible to copy the tab character in Notepad and insert it into the replace box. Thanks for that!

Krog, not sure if you've answerd my questions or not! I'm fairly familiar with C# as Ninjatrader uses it to code indicators and strategies (and I've spent a LOT of time coding in Ninja), but a lot of the complex stuff is hidden by Ninja so the humble coder doesn't have to do very much tricky OOP coding (unlike Metatrader...) But one thing Ninja does give you is access to all price data (ohlc) for any bar, and the value of any indicator for any bar. So if I wanted the 20 period sma for 5 bars in the past I only need to reference SMA(20)[5]. Too easy. From my (very cursory) look at FSB it would appear that the only information available is for the current candle. Having said that though, to calculate an indicator you need acces to historical price information, so it must be there in some form or other. Unless it's calculated on a bar by bar basis... dunno, more playing required!

Cheers,
Ian

Re: Some basic questions

I see what you mean --- FSB indicators loop through the price bars like an array and access the info at the current bar with an integer index (usually "iBar").
Ex, to get get current high:  High[iBar]
to compare with the previous high:  High[iBar] > High[iBar-1]

For SMA(20), that would be calculated first, then to access the MA values for the last 5 bars they usually have a for-loop to iterate backwards from the current bar. Donchian has an example:
http://forexsb.com/wiki/indicators/sour … an_channel

            for (int iBar = iFirstBar; iBar < Bars - iShift; iBar++)
            {
                double dMax = double.MinValue;
                double dMin = double.MaxValue;
                for (int i = 0; i < iPeriod; i++)
                {
                    if (High[iBar - i] > dMax) dMax = High[iBar - i];
                    if (Low[iBar - i]  < dMin) dMin = Low[iBar - i];
                }

iPeriod is the loop to go backwards from the current bar. From your description, it sounds like Ninja does the loop for you, but I'm not sure I've never used Ninja.

Re: Some basic questions

Hi krog,

Ninja doesn't do the looping automatically, is just makes the values available. It sounds like iBar is the equivalent of CurrentBar in Ninja. CurrentBar starts at zero for the oldese bar on the chart and increments by 1 for each bar in the chart. What Ninja (and Metatrader) also does is offer an alternate way of indexing, whereby the current bar is bar zero, the next oldest bar is bar 1, the next oldest bar 2 and so on. This means that the bar number changes every time a new bar is drawn on the chart (the old bar zero becomes bar 1, bar 1 becomes bar 2 etc). This a bit confusing at first, but it makes it very easy to calculate the latest value of an indicator as you just have to loop from 0 to however many bars you want to process, of if you want the latest High, it's High[0]. You can do the same thing with iBar of course, you just have to add iBar to the index before you start, depending on what your looping condition requires. Much simpler with "backward" indexing though I've found.

I'm happy to learn that I can index prices (and presumably indicator values) over past bars, have to say that did seem like an odd restriction. Given that, I think it should be no great drama to convert my indicators to FSB. I just have to understand the different structures and names given to preset functions and values (like iBar = CurrentBar) and I should be good to go!

Cheers,
Ian