Introduction

This article is about the functionality of the small widget I developed for JForex platform, which allows the user to: hide, show and manage any order or position on a specific chart and its relative instrument.

Setup in JForex

Save the .jfx file on your preferred C://...//Strategies folder and play in Local Run:


Hit the PLAY button and set orders appearance and colors from the Default Parameters Window:


1 - Running positions

A small widget with just 4 buttons will load on the top-left corner of every open chart, (note: all pictures are taken from a 13" laptop monitor):

  1. Show all filled positions and SL + TP orders, in that chart, for that specific selected instrument.
  2. Hide all running position drawings for that chart.
  3. Update all TP / SL modifications (if any).
  4. Open the "Conditional Orders" widget (detailed explanation on par. 2 - Conditional orders).
To better understand the functionality for buttons 1 and 2, consider the following example:


All positions are hidden from the charts, excluding the one where the user hits the " + " button.

1.1 - Modify TP/SL

The code will draw for each position an 'Entry' line together with 'TP / SL' lines and their respective prices. To modify SL / TP move the line to the desired level and hit the " = " button. Consider the following example:


1.2 - Close a running position

To close a BUY position, move the SL above or the TP below the ENTRY price and hit " = ". To close a SELL position, move SL line below or TP above ENTRY and hit " = ". Once the order gets closed, the respective Entry / TP / SL lines will be deleted from the chart. Remember that any modification will be effective only by clicking the " = " button. Consider the next picture as example:


Due to the actual code design, the lines will not be deleted from all instrument charts, requiring to refresh them hitting " - / + " buttons. The same refresh has to be done if a position will be closed by price reaching SL or TP.

1.3 - Key functionality

The core concept-idea is to simplify chart visualization when trading on small multiple charts for the same instrument or on multiple instruments with small charts, or similar scenarios. Consider this example:


Another example is using fast timeframes together with slower like Daily - Weekly. This is how the default visualization will appear:


While this is how it will appear by selecting visulization only in the faster timeframe:


2 - Conditional orders

As anticipated, to work with conditional orders there is a specific button which once hit, will open a secondary small widget on the top left side of that specific chart. Consider this picture as example:


The newly opened small widget basically has the same functionalities than the "running positions" one, with some few due differences. In detail:
  1. Show all pending orders and their respective SL / TP for that chart and the selected instrument.
  2. Hide all pending orders drawings on that chart.
  3. Update all TP / SL / ENTRY modifications (if any).
  4. Hide back the conditional orders widget from that chart.
2.1 - Modify entries and/or TP - SL

This works exactly as seen earlier for running positions: move the line and click the " = " button to update. Consider this example:


The " = " button once hit will update simultaneously all modifications in pending orders together with running positions as long as they are visible on the chart, since the code works by line detection.

2.2 Cancel a pending order

I had to find simple solutions to keep the functionality but in the same time managing with safety measures: I do NOT want to let possible moving an ENTRY order at a price rate where if filled, will be immeditately closed by the SL. Imagine for example moving a BUY STOP below its STOP LOSS price: this simply makes no sense. So, in these cases, the order will be canceled giving me the opportunity to simplify the actual code, while respecting safety measures. In detail, order cancelation will be executed if / when:
  1. Entry buy limit / stop > target price.
  2. Entry buy limit / stop < stop loss price.
  3. Entry sell limit / stop < target price.
  4. Entry sell limit / stop > stop loss price.
Another safety measure is taken if the users move the entry order above / below the current price: I do NOT want to let this be possible so simply there will be NO CHANGE in entry prices if / when the user sets:
  1. Entry buy limit / sell stop > current price.
  2. Entry buy stop / sell limit < current price.
I anyway reccomend to test the functionality on a demo account and test all possibilities. Consider this example:


2.3 - Key functionality

The idea is to have 2 separated environments, resulting in the ability to create interesting personalizations on a workspace. Consider for example working on 2 charts for the same instrument where a chart will be used to visualize only running positions, and the other will show only pending orders:



3 - Key limitations

Depending on anyone's trading attitude and needs, these limitations could be considered as an advantage or a disadvantage; I want to focus the main ones for article clarity:
  1. It is not possible to select an entry to partial / full close, or a TP /SL to remove it directly from the chart.
  2. In case of partial close, no line nor arrow will be drawn on any chart.
  3. TP / SL / Entry lines do NOT contain orders ID.
  4. IF price hits a TP/SL, the user will have to refresh the visualization (hit - / +).
  5. Impossibility to move entries or SL / TP in "warning areas" (see par. 2.2 - Cancel a pending order).
  6. Not possible to hide from visualization the TP / SL while showing Entry lines.
Conclusions

I tested many different situations but I did not explore all possible (maybe unlimited) trading environment combinations so please in case you find any issue or you have some suggestion on how to improve the functionality, please report here below on the comments section.

The .jfx file is downloadable at this link, and also from the JStore: search "One Click Hide - Show".
Translate to English Show original