diff --git a/Editing-JSON-Files.md b/Editing-JSON-Files.md new file mode 100644 index 0000000..145ea07 --- /dev/null +++ b/Editing-JSON-Files.md @@ -0,0 +1,26 @@ +All settings for **PT Magic** are stored in files using the **JSON** format. These files are plain text files so you can edit them with any text editor. However there are some things you have to know about the notation of the text. The following image shows an example taken from the "settings.analayzer.json" file where you configure your market trends and triggers for the market analyzer. The original file contains more data, the example has been shortened for the sake of this tutorial. + +![](https://i.imgur.com/nuniID9.png) + +### Lists and blocks +As you can see there are several sections of lines building a property block. There are 2 blocks from (line 8-21) for market trends. Line 7 has the label "MarketTrends" in it and the list of the following market trend blocks is surrounded by 2 brackets "[" and "]". So this type of brackets mark the beginning and the end of a list. It is important that each opening bracket (line 7) has to have a matching closing bracket (line 22). Another list starts at line 24 ("GlobalSettings") but its closing bracket is outside of this example image. + +Please pay attention to the red arrows in the image. The entries in the list are separated by a comma (line 14). As we have only 2 entries there is only 1 comma in line 14. After the last entry there has to be NO comma because there is no entry after that (arrow in line 21). It is a common mistake to copy and paste blocks and having a comma separator at the last entry of a list, so be careful with that. + +### Properties +Within each block we also have a list, a list of properties. These lists are surrounded by another type of brackets: a starting "{" at line 8 and a closing "}" at line 14 for the very first porperty list. You can see that the entries in this property list are separated by a comma as well. For the first list (line 9-13) there is a comma at the end of each line after the property. But after the last property there is no comma (line 13). + +The property itself has a key and a value. For example the property in line 9 has the key "Name" and the value "Exchange1h". Key and value are always separated by a colon ":". + +You may have noticed that some values are surrounded by a quotation mark (") and some are not. If you have to use a quotation mark depends on the type of the value: String of characters use quotation marks, numbers and boolean values (true/false) don't. + +### Editing the files +It is a good idea to use text editors that have a code folding feature. In the image above you can see a red line at the left with little squares on it. The editor recognizes the individual blocks in the list and the matching brackets. So if you click on one of the sqares it will fold the current block. This helps you to have a better overview over the document structure. And if a closing bracket is missing you will notice because the folding will not work. + +For windows a good editor is [Notepad++](https://notepad-plus-plus.org/). + +This is how the file looks if you collapse most of the block: + +![](https://i.imgur.com/WwfG4il.png) + +All settings ("EndOfTheWorld", "TankingDown" etc) are on one screen due to the collapsed view and you can now open let's say the "Triggers" part to tune the trigger values one by one without a lot of scrolling. \ No newline at end of file