|Price Action Manual v1.0|
|From JTAWiki, a project by J Talon LLC|
Price Action is an Expert Advisor which has its entry method based solely on Price Action. It will place a trade as per the entry conditions, then take a profit if the price continues to move in the same direction. If the price retraces then it will place additional trades in a grid pattern, with the safety of Trend Guidance if required.
Price Action will place the First Trade based on the set entry method. The volume of the first trade is based on the Lot Size Calculation. If the price goes against the initial trade, further trades will be placed based on a Grid System with increasing Lot Sizes and optional TrendGuidance, until the price retraces enough to hit the Take Profit point. In addition to closing the basket at TP, there are Other Exit Strategies, including Stop Loss and Trailing Stops, and Emergency Close All.
Price Action can run on any chart and timeframe, and uses Trade Tracking with a unique Magic Number and Trade Comment to identify trades with your broker. The portion of the Account Balance used by each chart to trade Price Action can be set using Portion Control. To help you keep track of all the charts running Price Action, and the open trades on those charts, another EA is provided, called JTA Dashboard.
But Price Action is not only about making profits, it is also about protecting your account balance when things do not go according to plan, by using Equity Protection. This is achieved by using Portion Control, Maximum Drawdown Limits and power out stop losses.
You can download the installation file from our store by using the link in the email sent to you confirming your payment. You should bookmark this link, to ensure that you always have access to download the installation file.
Please follow the instructions on the EA Installation page of our Wiki.
Use of the EA relies on a valid CID registered on our server. Get more details on registering and changing your CID here.
As long as you remain a subscriber, or if you have purchased Price Action, then you are entitled to receive all upgrades of the EA free of charge for life. When an upgrade is released, you will be advised via email to the email address used when you made your payment. If you would like to change your email address, then please send details of the new address to sales@JTAToday.com.
The EA will automatically download any new version to a folder on your hard drive through the Auto Update function, and will display a button on the chart to inform you that a new release is available. Read more about where the file is stored, and how to install it from the Auto Update page of the Wiki.
If you have problems when installing the files, attaching it to a chart, or running the EA, please go through each of the items on the Experts troubleshooting page of the Wiki.
After you have successfully installed the EA there are many checks made on the Input Parameters and your Account Settings to ensure that there are no problems. If there are problems which are serious enough to stop the EA from trading then you will see an Error Message on the Overlay and/or in the Experts tab of the MT4 Terminal window, and you can get more details of the error and possible solutions on the Error Messages page of the Wiki. The EA will also display a button on the chart which will take you to the relevant section of the Error Messages page when clicked.
Price Action will only be allowed to open orders if AllowTrades is set to
true. If AllowTrades is set to
false then no trades will be placed, but you will be able to view the details on the chart overlay - see Restricting Trading for details.
falsewhen you load Price Action on to a chart, then when the overlay has settled down after a few ticks, and the 'Waiting for next tick ...' message has been cleared, you should click the 'Allow Trades is set to false' button on the chart overlay, which will then allow trading without having to change the EA's Input Parameters again.
You can also set AllowTrades to
false again from the chart by clicking the red 'x' by the Trading Times label.
Trade Long and/or Short
Under normal circumstances Price Action will open either Long (Buy) trades or Short (Sell) trades. However you can restrict trading to one direction only by setting either TradeLong or TradeShort to
false. If both parameters are set to
false then the EA will be stopped with an error message.
The first trade of a basket will be opened by comparing the EntryPrice setting of the previous bar with that of the LookBackBars bar of the chart. If the value is rising it will place a Buy trade, and if falling a Sell trade. The EA will place a trade immediately, or at the start of a new bar if NewBasketOnNewBar is set to true. You can set the timeframe of the 'NewBar' by using the NewBarTF setting. Price Action will send a market order to open the first trade of the basket.
You can set an upper and lower price beyond which the EA will not be allowed to open a new basket of trades. These limits are set with BuyLimitMax, BuyLimitMin, SellLimitMax and SellLimitMin. Leave the values as
0 to allow trading no matter what the price. Note that these limits only apply to the first trade of a basket - subsequent basket trades will open at any price when allowed by the Grid Entry conditions.
To set any of the limits simply enter the price in the relevant parameter. The EA will draw a line on the screen showing where the limit has been set, and it can be manually changed on the chart by highlighting the line (double click it so that the anchor points can be seen at each end of the line) and drag the line up or down to your required position. The EA will now react to the new Limit Max or Min level, but please note that it will not change the value set in the EA parameters so if you restart the EA the limits will revert to their original settings.
Manually Starting a Basket
If you are an experienced manual trader, it is also possible to start a new basket based on your own criteria by placing a manual trade.
Starting Lot Size Calculation
Price Action determines the size of the initial lot based on whether UseMM is set to
If set to
false, then the value entered in StartLot will be used for the first trade of every basket, no matter what the account size.
If UseMM is set to
true, then Price Action will calculate the lot size based on the Portion Balance, with a minimum lot size of StartLot. If BaseMMOnEquity is set to
true then the Money Management calculation will be based on the Portion Equity rather than the Portion Balance, which will result in lower lot sizes if there are other charts on the account in drawdown.
Because Price Action can open several levels in the grid at increasing lot sizes, to ensure that the number of open lots does not get excessive, we need to decide how many levels may be open at once. Many baskets of trades will close after only one or two levels, so Price Action therefore assumes that 2 levels is the average number of levels which will be open at once, and this is the default setting of the Level variable. If you want to be more cautious, increase Level to a higher value, which will then reduce the initial lot size.
The starting lot size is calculated to open 0.01 lots for each $1,000 account balance on an account with 500:1 leverage with Aggression set to its default value of 1. If your account has a lower leverage then you will see an increase in the account balance required for each 0.01 lot because the EA will take the required broker's margin into account.
Instead of allowing the EA to determine the Lot Size per Portion Balance you can set a fixed value yourself by entering the required value as a negative amount in the Aggression parameter. For example, setting Aggression to
-1500 will fix the starting lot at 0.01 lot per $1,500 of the Portion Balance.
Lot Size Safety Precautions
In order to trade more safely, and to allow for those times when the number of trades in a basket exceeds the assumed average of 2, it is recommended that you use double the required portion balance, or to put it another way, use half the initial lot size. This can be achieved by using the Aggression setting. If Aggression is set at
1, then the lot size will be calculated exactly as described above. In order to reduce the lot size by half, Aggression should be set to
If your broker has a limit to the number of lots which are allowed to be open at one time and this value is entered in MaxOpenLots, Price Action will ensure that the number of open lots at Level does not exceed the maximum allowed for this portion of the account if possible.
If you are using Money Management and your live/demo account is not held in USD, then it is important that the formula used in calculating the starting lot size is consistent with our back tests, so our proprietary Currency Converter will automatically convert your Portion Balance into USD before performing the MM calculation.
In order for Currency Conversion to work the Currency Symbol for your account currency/USD must be visible in the Market Watch window - the EA will automatically add it if it is not already present. If the Currency Symbol has a Prefix or a Suffix then these will also be determined automatically by the EA.
|The Currency Converter can not work when back testing because MT4 is not capable of using currencies other than the one under test. When back testing you should always use a demo account in USD.|
The overlay display will show you the Portion Balance currency conversion, the approximate ratio for the portion balance for every 0.01 lot (or the exact value if set through the Aggression parameter), and whether the calculation was based on the Account Equity.
Grid Levels Lot Size Calculation
Lot Levels and Lot Sizes
Price Action used a grid system for opening further trades, and the lot size of each of these trades can be set by the user, using the LotMultiplier parameter.
If the multiplier number is greater than 1 then the lot sizes will increase, and setting a LotMultiplier of 1 or less will produce constant lot sizes. Because the LotMultiplier may create lot sizes with a fraction of 0.01 lot (which is not allowed by your broker), you have the option of rounding the lot size Up, Down, or to the Nearest valid value using the LotRounding parameter.
The above calculations assume that you are trading on an account with the normal Contract size, which is $100,000 per 1 lot. If you are using a Nano account, where the contract size is only $10,000 per 1 lot, then the lot sizes should be multiplied by 10 to achieve the same results. Price Action will do this automatically if you set NanoAccount to
true. If you do not want Price Action to use the increased lot sizes, then leave NanoAccount as
false. If you're not sure whether your account is a Nano account, open the Strategy Tester in your MT4 application, choose any Forex symbol, click 'Symbol properties', and check the line which says 'Contract size', or set Debug to
true and check the Size value under Lot Data on the overlay.
| If you set NanoAccount to |
When using Trend Guidance to delay the opening of the next level of a basket there may be occasions where the price movement is very high, so opening a trade with the usual lot size progression will still result in the BE point being far away from the current price. If UseGridLot is set to
true then the EA will calculate where the current price is compared to the grid spacing, and will place a trade with the appropriate lot size for that level of the grid. In effect the Trend Guidance delay is causing those levels of the grid to be 'skipped' but the trade is placed as though those levels were present.
If Trend Guidance prevents a trade opening over a very large movement in price you can limit the GridLot lot size with the GridLotMaxMult parameter.
You can run Price Action on any account, and can run it along side any other EA. In order to split your Account Balance between individual EAs and charts, you set the percentage to use with PortionPC.
If a value between
100 is entered in PortionPC, then Price Action will use that percentage of the Account Balance to calculate the portion that it is allowed to trade with.
If there are no open trades in the basket then as the Account Balance changes, then so will the Portion Balance. If there are open trades then you can determine whether the Portion Balance is allowed to change by using the PortionChange parameter. A value of
1 (default) will allow the portion balance to increase if the account balance increases, a value of
0 will keep the same portion balance no matter what happens to the account balance, and a value of
-1 will allow the portion balance to increase or decrease as the account balance increases/decreases.
If a value greater than
100 is entered in PortionPC then Price Action will allocate that amount as the Portion Balance that it is allowed to trade with. Because the PortionPC amount is fixed, the Portion Balance will not change as the Account Balance changes.
For all future examples in this manual it will be assumed that Price Action is the only EA running, and PortionPC is set to
100 (its default value).
Setting the Grid
Once the first trade has been placed, there are two possible outcomes. Either the price will go in the direction of the trade, when it will be closed at a profit, or the price will go against the trade. On these occasions, Price Action's strategy is to open another trade at a set distance from the first.
The distance is set with the SetCountArray and GridSetArray parameters. If you are not using Trend Guidance then the next basket trade will be placed at the trigger point, unless GridTradeOnNewBar is set to
true in which case the trade will open at the first tick of the new bar as long as the price is still beyond the trigger point.
SetCountArray and GridSetArray
In order to save you from entering the distance for each level in the grid individually, Price Action allows you to set them for 'blocks' of levels. SetCountArray is used to determine the number of levels in each block, with GridSetArray setting the corresponding grid levels. Each value for different SetCountArray and GridSetArray should be separated by a comma.
The maximum number of trades allowed in any basket is set with MaxTrades, and because Price Action will fill in the grid levels up to the value of MaxTrades with the final value of GridSetArray, there is no need to enter the number of levels in the final block.
- The first trade will be placed according to the entry conditions.
- This first trade is known as level 1 of the basket, and also forms the first trade of the first block of SetCountArray. This means the grid distance for the next level is taken from the first block of GridSetArray, and so level 2 will open 90 pips away.
- Because no more SetCountArray values have been set, Level 2 up to MaxTrades will use the same grid distance as the first block of GridSetArray, so trade 2 onwards will be placed at a distance of 90 pips.
For more detail of how the settings should be used, and a much more detailed example, please read the description in the Setting the Grid section of the Evolution Manual.
If TrendGuidance is set to
true then the next basket trade may not be opened immediately, but it will wait until the Trend Guidance indicator agrees with the trade direction. The indicator that we use is called PA_StepMA, and it can be found in the Indicators section of the MT4 Navigator.
Once Trend Guidance is in play then it will only allow a further basket trade to open if the indicator Mid Line (blue) is above (Long baskets) or below (Short baskets) the Slow line (red). Trend Guidance will not be allowed to open a trade until the price has passed the GridSetArray point, but once this point has been passed then a flag is set and Trend Guidance may open a trade at a point before the GridSetArray point unless UseMinimumGridSize is set to true. If GridTradeOnNewBar is also set to true then the trade will not open until the first tick of the new bar as long as all entry conditions are still met.
In a fast moving market, it is possible that Price Action could open several grid levels in a short period of time. The external variable EntryDelay is used to set the number of seconds delay before the next level is allowed to open. The time remaining before the next level can open will be shown on the overlay.
If you decide that there is a better place to enter the next trade based on your experience, rather than use the setting automatically generated by the EA, you can highlight the entry line on the chart by double clicking it then drag the line to the position that you require.
After a basket has opened, the on screen display will inform you when the next level will open, together with the reason why the level has not yet opened.
If you are an experienced manual trader, and feel that you could do a better job of picking entry points for further levels using support/resistance or Fibonacci levels it is also possible to open a manual trade.
Adding Trades Manually
It is possible to place a manual trade to either add to an existing basket, or to create a new one. In order to use the BUY and SELL buttons on the display you must have dButtons set to
true. It is also possible to place trades using the Knight-Fire tool provided by ianj, but you must ensure that the correct magic number and lot size are entered.
If there is not a basket of trades open then the lot size of the new trade will be set to the normal Starting Lot size.
If there is already a basket open then the manual trade can only be placed in the same direction as the basket. The lot size used will follow the normal grid lot size calculation. You will be allowed to open a manual trade even if AllowTrades is set to
If ConfirmButtons is set to
true then you will be asked to confirm the trade placement.
|The Buy and Sell buttons used for manual trading are not limited by any of the rules which limit the EA from trading. They will ignore any EntryDelay, MaxSpread, AllowTrades etc. settings.|
|If you use ConfirmButtons then the time taken to place the trade will take longer, and it is possible for the price to have changed so much that the trade is rejected by the broker. Please check the Terminal/Experts log for any error messages and be prepared to place the trade again if required.|
Closing Trades Manually
|It is not recommended that you close individual trades in a basket, other than the latest level opened in each basket. Doing so can have unexpected results, and can affect the lot size of subsequent trades making it harder to close the basket.|
If you need to close trades manually then we recommend that you close all the trades of a basket, which can be achieved quickly by using the Emergency Close All function.
Price Action uses a take profit which can either be Fixed or based on an Array.
Fixed Take Profit
Setting the parameter FixedTPPips to anything greater than 0 will set the TP point at a fixed distance from the break even point of the basket. A setting of 0 will turn this function off.
Take Profit Array
The Take Profit array is set in the same manner as setting the grid, although it does not use the same blocks as are used in the grid. You set the TP blocks with the TPCountArray setting, and the TP size is set with the TPPipsArray setting. The Take Profit point is determined by using the current grid level with the TPCountArray to decide the value of TPPips, and that TP size is then used to set the TP distance from the Break Even point.
|If both Fixed Take Profit and Take Profit Array are in use at the same time then the EA will close the trades when the first TP point is hit (i.e. the TP point closest to the BE point)|
BreakEven and BEPlus
In order to move the TP closer to the BE point at higher levels of the basket there are 2 more functions which can be used.
If BreakEvenTrade is set greater than
0, when the basket gets to the level set it will close all trades when the price reaches the break even point, no matter what point the original TP was set at.
If BEPlusLevel is set greater than
0, when the basket gets to the level set the TP line will be adjusted to the BE point plus/minus the number of pips entered in BEPlusPips. If BEPlusPips is a positive value the TP line will ensure that the basket closes at a profit, but if it is negative the basket will close at a loss.
Other Exit Strategies
Stop Loss and Trailing Stops
Each basket can have a Fixed stop loss and/or a trailing stop.
Fixed Stop Loss
To use the Fixed Stop Loss you must set FixedSLPips to a positive value. If it is set to
0 then this stop loss function will not be used. The stop loss will be fixed at the set number of pips from the basket break even point, and will be shown on the overlay as a red dotted line if you have dLines set to
To use the Trailing Stop you must set TSLPips to either a positive or a negative value. If it is set to
0 then the trailing stop function will not be used. The trailing stop line will be shown on the overlay as a gold dashed line if you have dLines set to
If a positive value is entered for TSLPips, then the trailing stop will fixed at the set number of pips from the start point, and will trail the price at that fixed distance.
If a negative value is entered, then it will be treated as a positive value, and will work exactly the same as the normal trailing stop except that the pip value of the trailing stop will reduce as the price moves further from the start point. This means that as the basket makes more profit the trailing stop reduces to lock in more of that profit. The value of the trailing stop will not reduce lower than the value set in TSLPipsMin (which should be entered as a positive value). The reduction of the trailing stop uses a cosine function, which means that it will start reducing slowly at first, then speeds up as the price moves, and will slow down again it reaches TSLPipsMin. The distance over which the trailing stop reduces from TSLPips to TSLPipsMin is set using TSLMaxMinDist.
You can select the point at which the trailing stop will start through the TSLStartAt parameter, which accepts the following values:
- 0 (BE) to start trailing when the price reaches the Break Even (BE) point. This setting may cause the basket to close at a loss because the trailing stop will start TSLPips before the BE point is reached.
- 1 (BE+) to start trailing when the trailing stop is at the BE point. This method will start trailing when the price is TSLPips past the BE point, and will normally ensure that the basket closes at a profit.
- 2 (TP) to start trailing when the price reaches the Take Profit (TP) point. This method will start the trailing stop at TSLPips before the TakeProfit point, and will normally produce a profit as long as TSLPips is smaller than the expected TP.
- 3 (TP+) to start trailing when the trailing stop is at the TP point. This method will start trailing when the price is TSLPips past the TP point.
- 4 to 100 which will be treated as a percentage, and the trailing stop will start when the price reaches the set percentage of the projected profit. This method may cause the basket to close at a loss if the set TSLPips value is greater than the calculated percentage of the projected profit.
For all settings of TSLStartAt other than
0 you can force the TSL point to be on the correct side of BE by setting TSLProtectBEPips to a value greater than
0. Do not set the value too high because if it is greater than the actual TP then this function will be ignored. A value of
2 pips will usually do a good job, and a setting of
0 will close at or just below BE, which may result in a small loss. Use a setting of
-1 to turn this feature off.
|If the Trailing Stop is active, then a basket of trades will not close when the profit target is reached - it will always wait for the trailing stop to be hit before closing.|
Emergency Close All (ECA)
This is a way of simply getting out of all trades on this chart. A user may have several EAs on their account, or several charts running Price Action, and it might be difficult to find every trade relating to this chart and close them out.
The quickest way of initiating ECA is to click the ECA button on the chart, if you have dButtons set to
true. If you have ConfirmButtons set to
true you will be asked to confirm your action. If ConfirmButtons is set to
false then all trades will close immediately. Once the trades have closed the button will revert to its normal colours, and internally the value of EmergencyCloseAll will be set to
false so that further trades will not close automatically.
You can also use the ECA button against the chart summary on the JTA Dashboard if it is active, which acts exactly the same as the button on the chart as described above.
You can also initiate ECA by using the EA's Input Parameters (F7), and setting EmergencyCloseAll to
true. Once you click OK, Price Action will close ALL open trades on this chart, and the display overlay will warn you that EmergencyCloseAll is set to
true. This is a reminder to change the setting back to
false, because if Price Action opens more trades and you decide to change the parameters for another reason but do not change EmergencyCloseAll back to
false, Price Action will once again close all trades.
Price Action will close all trades immediately but will continue trading. Depending on what entry method you are using, you may get an immediate placing of a new trade if entry conditions allow. If you also want Price Action to stop trading after ECA, you should set ShutDown to
true prior to setting EmergencyCloseAll to
Equity Stop Loss Protection
Equity Protection was developed to prevent a total blowout of your account. No matter what entry settings are used there is no way to 100% guarantee that the first trade of the basket will open in the right direction. We must therefore accept that Price Action will sometimes get it wrong, and will need to open a basket of trades in order to trade out of the situation.
However opening extra levels in a basket at increasing lot sizes will increase the drawdown on the account, and could result in losing the whole of the balance.
Price Action will protect you from losing all the account balance by using Portion Control to allocate only a fraction of the total account balance to this chart, and by using MaximumDDpc to limit the amount that can be lost. If the drawdown of the trades opened by this chart reaches MaximumDDpc, then all open trades will be closed.
If you were unfortunate enough to have an EP hit, then Price Action would just carry on trading without some means of stopping the chart from trading. This is provided by the Stop Trade Percent feature of Price Action. This is designed to stop Price Action trading on this chart if the portion balance drops by the percentage set in StopTradePercent.
The portion balance can reduce from having an EP hit, or from the stop losses present in other areas of Price Action.
If you want to restart trading after it has been stopped, you will need to 'reset' Price Action. This can be done by going into the EA Inputs (F7) and clicking OK, or removing Price Action from the chart and reloading it. Both of these methods will force Price Action to restart, and reset the Stop Trade Percent.
The value of the Portion Balance used for the calculation of Equity Protection and Stop Trade Balance for each chart is calculated when the basket opens, and may change depending on the setting of PortionChange - see Portion Control. If PortionChange is set to 0 or 1 then this ensures that any EP hits from other charts on this account, or a withdrawal from your account, will not have a knock on effect on this chart, which is still making profits.
Broker Stop Out
If the margin level on your account drops below the minimum value set by your broker then the broker will start to close trades in order to release margin to allow the account to continue trading. The EA can prevent the margin being used up by setting MinMarginLevel - if any new trade would reduce the account margin level below the percentage set in MinMarginLevel then the trade will not be allowed to open.
Power Out Stop Loss (POSL)
Price Action does not send Take Profits or Stop Losses to your broker. In the unfortunate event of you losing your internet connection, Price Action will not be able to monitor trades, so will not be able to close them at a profit, but worse, your open trades will not have any of the above methods of Equity Protection.
In order to maintain Equity Protection you can set UsePowerOutSL to
true. This will allow Price Action to send a stop loss to your broker, based on the value of POSLPips (default
100) from the break even point of the basket.
When the basket opens the first few levels, the lot sizes are small so a movement of 100 pips will result in a small loss, and will be nowhere near the 50% set in MaxDDPercent. However, as lot sizes increase at higher levels, a movement of 100 pips will cause a much higher loss, so the value of POSL is reduced to limit the maximum loss to MaxDDPercent + 1%. The additional 1% is included so that POSL can not interfere with the normal logic of Price Action.
Once POSL has been set by Price Action, it can not be removed manually because Price Action will automatically reinstate it. In order to remove it, you must leave UsePowerOutSL at
true, but change POSLPips to
0. After the next tick, all stop losses should have been removed from the basket trades, and you can change UsePowerOutSL to
As long as UsePowerOutSL is set to
false, you can set a manual stop loss on any trade, and it will not be overwritten by Price Action. Assuming that the trade has not been closed normally by Price Action, your broker will close the trade at the SL you have set.
Setting the AllowTrades parameter to
false will not allow the EA to open or close any trades on this chart, even though the overlay display will still be updated. You can use this setting to ensure that you have entered other parameters correctly, and the chart portion and starting lot size are to your expectations.
falsewhen you load Price Action on to a chart, then when the overlay has settled down after a few ticks, and the 'Waiting for next tick ...' message has been cleared, you should click the 'Allow Trades is set to false' button, which will then allow trading without having to change the EA's Input Parameters again.
However, even with AllowTrades set to
false you will still be able to use the buttons on the chart to open a new BUY or SELL trade, or close all trades with the ECA button.
| AllowTrades is set to |
Once the EA has started running there are several other settings which can be used to restrict trading:
You can specify at what times Price Action should trade by using the time filter. The time settings are based on the start and stop times during each day of the week, with an additional setting for Non-Farm Payroll Fridays. The start and stop times are based on the 24 hour clock, and can be entered as whole hours (8-15), or hours and minutes using a colon (8:30-16:45), or a combination of the two (9-16:45).
You can set as many trading times during each day as you like by separating each start and stop time with a comma (0-5:30,11-16:45,20:30-24). It is important that each stop time is greater than the previous start time, and each start time is greater then the previous stop time (if any). Each different Start-Stop period during a day is called a session.
To start trading at midnight, set the start hour as 0 (0-?), and to stop at midnight set the stop hour as 24 (?-24). If one day's stop hour is 24, and the next day's start hour is 0, then trading will continue over midnight, and the two periods will be treated as one session.
If you don't want to trade at all during a day, then leave that day's trade times blank.
The start and stop times are based on either your local time, the broker's time, or GMT. All our backtests are based on GMT times, but you have the choice of using local or broker time if you wish. Here is how the settings should be entered:
- GMT Time Settings
- Enter the start and stop times for each of the sessions that you want to trade each day based on GMT.
- The EA needs to know what the time difference is between GMT and your broker, which you can set with BrokerTimeOffset. (Your broker's web site should have details of what their GMT offset is - if not drop them a line). This time difference can also be calculated automatically if AutoGMTOffset is set to
- Local Time Settings
- Enter the start and stop times for each of the sessions that you want to trade each day based on your local time.
- The EA needs to know what the time difference is between your local time and your broker, which you can set with BrokerTimeOffset (Take the Broker Time from the Overlay and deduct your local time. Enter this time difference in BrokerTimeOffset - if the difference is negative make sure you enter a negative value). If you are using local time settings then you must ensure that AutoGMTOffset is set to
- Broker Time Settings
- Enter the start and stop times for each of the sessions that you want to trade each day based on your broker's time. Remember that you may need to change the trading times if your broker is subject to Daylight Saving changes.
- The EA does not need to make any adjustments for the GMT offset, so make sure that BrokerTimeOffset is set to 0 and AutoGMTOffset is set to
You can choose how the trading times are displayed on the overlay by the use of the DisplayBrokerTimes setting. If set to
true then all trading start and stop times will be displayed at the broker's time zone. If left at the default of
false the times will be displayed as the user's input times, as they were previously.
The display overlay will inform you of the stop time of the current trading session or the start time of the next trading session in Green. If there is a basket of trades open and the session has ended, the display will show the start time of the next session in Yellow. The broker time offset will be shown in brackets after the broker time, and will be displayed in blue if set manually, or green if calculated using AutoGMTOffset, and the Local Time:GMT difference will also be shown in green if positive and red if negative.
ShutDown is a way of telling Price Action that we don't want to continue trading after the current basket is closed, but the EA will continue trading as normal while the basket is open. Once the basket closes, Price Action simply will not place any more trades until ShutDown is reset to
false. ShutDown can be turned on or off at any time and the display overlay will inform you when it is turned on.
ShutDown can be set to
true in the parameter settings of the EA, or simply by clicking the SD button on the chart if dButtons is set to
true. You can also use the SD button against this chart's details on the JTA Dashboard. If using the Buttons, you will be asked to confirm your action if ConfirmButtons is set to
The colour of the button will be reversed when ShutDown is
true, and the chart display overlay will also inform you when it is turned on. You can turn ShutDown on and off as often as you like by clicking the SD button.
Once the basket closes the overlay will display that trading has stopped, and that you will have to set ShutDown to
false in order to continue trading. Again, this can be done simply by clicking the SD button.
Holiday Shut Down
The HolidayDates are entered in the format [day]/[month]-[day]/[month], and if there is more than one holiday period they must be separated by a comma. All dates are inclusive, so Price Action will restart trading the day after the final holiday date. The next holiday period will be displayed on the display overlay if it is enabled, giving confirmation that the dates have been entered correctly.
You can also automatically set Price Action to shut down over the Easter period. This is also controlled through the HolidayDates parameter, but the information is entered in the format 'E-2+3', where the E tells the EA that it is an Easter break, the -2 will shut down for the 2 trading days before the Easter weekend, and +3 will stop trading for the 3 trading days after the Easter weekend. The date of the Easter weekend is automatically calculated, and both the - and + portions must be present. If you do not want to restrict trading during one of the periods then enter -0 or +0, but note that the EA will not trade on either Good Friday or Easter Monday regardless of your settings.
If a basket is open when the holiday shutdown starts, Price Action will continue to monitor the trades, and will still open new levels if entry conditions allow, unless HolidayAllowTrades is set to
false, when the current trades will still be monitored, but no more trades will open until the holiday period is over.
Limiting Open Charts
Price Action will allow you to restrict the number of charts with open trades. This means that you could set up 10 charts all running Price Action, but only allow 3 of them to have open trades at once. The other 7 will wait patiently until one of the three closes their basket, and will then open a new basket if entry conditions allow. You can also restrict a chart from opening a new basket if the Drawdown on another chart is over a set limit. Both of these restrictions can be applied to only Price Action charts, or to charts from any of JTA's EAs.
Because the control of the number of open charts and drawdown needs to be controlled from a central location, this function is run from the JTA Dashboard, which is where you will find all the relevant parameters.
Price Action keeps track of all open trades by using a unique* magic number.
- I say unique because it uses an algorithm based on:
- The EA name,
- The EANumber,
- The chart on which Price Action is running, and
- The time frame of the chart.
This algorithm produces a number between 1 and 2,147,483,647, and while it is extremely unlikely that different instances of any of our EAs would result in the same magic number, it is possible. It is therefore recommended that once Price Action has been added to a chart that you check other instances of our EAs to ensure that the magic number is indeed unique.
In order to run Price Action on 2 or more charts with the same pair and timeframe, all you need to do is to alter the EANumber, so the first chart has an EANumber of
1 (default), the second an EANumber of
2, etc. This will generate a different magic number for each chart.
There is no need to use a different EANumber to differentiate between the same chart and TF when used with different EAs because they have a different EA name, so will have different magic numbers.
You can bypass the automatic magic number generation by setting a magic number of your own. This is achieved by setting the EANumber to any unique number greater than
99. This EANumber will then be used as the magic number.
You can find which magic numbers are used by setting Debug to
true, and checking the Terminal Experts window.
Lock Time Frame
In order to avoid inadvertently changing the time frame of the chart, which may result in a different Magic Number being generated so the EA will no longer manage any open trades, you can lock the time frame as desired. The LockTimeFrame parameter is set to 0 by default, which allows you to change the chart to any time frame you desire. In order to lock the time frame simply change the LockTimeFrame parameter to the desired time frame. Then if you inadvertently change the time frame of the chart the EA will automatically change it back to the set value.
If you run Price Action on several charts, you can keep track of which instance of Price Action opened / closed which trades by using the TradeComment parameter. By default this is set to the EA name and version, or to the set file name if you load a set file, but can be changed to anything of your choice. You can view the Trade Comment in the 'Trade' and 'Account History' tab of the 'Terminal' window of the MT4 application. If the 'Comment' column is not visible, right click anywhere in the Terminal window, then left click 'Comments'.
It is recommended that you change TradeComment from the default EA name and version, so as not to inform your broker which EA is in use.
|MT4 build 600+ puts a limit on the number of characters which can be used in the trade comment to 31. Please ensure that your TradeComment is 31 characters or less to enable it to display in the Comment column.|
If you are not using the default settings then you can also use the UserComment on the display to identify which settings are in use on this chart. The default setting will show the EA name and build number, but it can be changed to anything you like.
The Overlay will show you a wealth of information, most of which is fairly self explanatory. However there are times when a label will display a different message, or will change colour, so here are some of the subtle changes that you may not notice at first:
Trading Times - this label will normally display in the default display colour if you are displaying the trading times as at the broker's time zone (DisplayBrokerTimes is set to
true) or in green if DisplayBrokerTimes is set to
false, and will give details of when the current session will end or when the next session is due to start. If there are open trades in the basket when a session comes to an end, the next start time will be displayed in yellow.
This label will also show, in red, some of the reasons why trading has been prevented, for example:
- The EA is still processing the first tick after being loaded,
- AllowTrades has been set to
- The spread is greater than MaxSpread
- The account margin is insufficient to open the next trade.
- Trading has been stopped because of an error in the settings - check the Terminal Experts tab and the Error Messages Page for the reason why.
If the EA is running with a small portion balance the colour of the Starting Lot will warn you. A portion less than $1,000 per 0.01 lot will display in Red, then up to $2,500 will display in Orange. For safety you should always use at least $2,500 per 0.01 lots.
The number of open BUY and SELL trades is normally displayed in DeepSkyBlue. They will be shown in Yellow when BEPlusLevel has been reached, Orange when BreakEvenTrade is reached and Red at MaxTrades.
The line showing how many lots will open for the next trade will change depending on which function is preventing the trade from opening.
Price Action is a very complex EA, and in order to ensure that each function is working correctly it is sometimes necessary to enable a Debug print.
You are able to decide how verbose you would like the debug messages using the DebugLevel parameter. Setting the value to 0 will turn off all debug messages, but you will still see any error messages. Please read the DebugLevel parameter description for other settings.
Any setting greater than 0 will automatically print details from the initialization function, including:
- A list of the levels, lot and grid sizes.
- All Magic Numbers, in case you want to open a manual trade.
- Detailed information about your Account, MT4 and EA settings in the display overlay.
With the complex functions in our dll file there are many additional errors which you may encounter. In order to obtain feedback from the dll another parameter is provided, DebugDLL, which will output messages to a log file.
| It is highly recommended that you do not set DebugDLL to |
If dLines is set to
true then the following horizontal lines will be displayed on the chart at various times:
- Green Dash-Dot line - MT4 line to show the open price of a Buy or Sell trade.
- Orange Solid line - line to show the Break Even point of all open Basket trades.
- Gold Solid line - line to show the Take Profit point of the open Basket trades.
- DodgerBlue Dash-Dot-Dot line - line to show the trigger point of the next Buy trade.
- FireBrick Dash-Dot-Dot line - line to show the trigger point of the next Sell trade.
- Red Dot line - line to show the Basket Stop Loss.
- Gold Dot line - line to show the basket Trailing Stop point.
- Gold Dash-Dot-Dot line - line to show the trigger point of the Trailing Stop function.
The display overlay also has the option to display several buttons on the chart. Set the parameter dButtons to
true to display them, and to
false to remove them.
As soon as a button is pressed, its colours will reverse so that you can see that the function has been triggered, and they will revert back to normal once it has finished. The only exceptions to this is the ShutDown (SD) button, which will remain in the reverse colours all the time that ShutDown remains
true, and the F, M and P buttons which will be disabled for 1 minute in order to prevent overloading your computer with multiple clicks.
There are 5 buttons which affect the overlay display, which are the B, O, T, E, and D buttons. These buttons act as follows:
- D - will turn the Debug information on/off. Note that this will also change the setting of the Debug parameter, with the associated printing of the Debug information in the Experts or Journal tab.
- E - is disabled because there are no Entry Conditions.
- T - will turn the open Trades information on/off.
- O - will turn all the remaining Overlay information on/off.
- B - will remove all Buttons, other than the B button, from the screen.
There are 3 buttons which provide links to pages on our web site, which are:
- F - will open your web browser and take you to the Price Action Forum.
- M - will open your web browser and take you to the Price Action Manual on the Wiki.
- P - will open your web browser and take you to the Price Action Parameter page on the Wiki.
The following buttons affect how the EA trades, and you can choose whether these buttons will execute as soon as you press them, or whether they display a messagebox with details of the action to be taken which you have to confirm, by setting the parameter ConfirmButtons. These buttons are:
- ECA - see Emergency Close All for operation details.
- BUY - see Adding Manual Trades for operation details.
- SELL - See Adding Manual Trades for operation details.
- SD - See ShutDown for operation details.
- Reset - This button will allow you to reset the Maximum Drawdown percent as shown on the display overlay. It will also reset the Maximum Drawdown value and date/time which is displayed if you have Debug set to
true. Note that if you have a basket of trades open when the Reset button is pressed, the Maximum Drawdown percent and value will be set to the Drawdown and Minimum Profit figure on the overlay, and the date/time of that drawdown will be set to the date/time at which the button was pressed.
These buttons will only appear under certain circumstances:
- If you are using the JTA Dashboard then a DB button will also be visible on the chart, which will bring the DashBoard chart to the top when clicked.
- When AutoUpdate has downloaded a new version you will see a 'New Version Available' button next to the EA name and build number on the chart overlay.
- If the EA has been stopped because of an error you will see a 'Click for help with this error' button which will take you to the relevant error message description on the Error Message page of the Wiki.
- If your CID has changed you will see a 'Open CID Swapper' button, which will allow you to change your own CID.
All the buttons will act as they should while back testing in visual mode. The only difference while backtesting is that the Strategy Tester is unable to display a message box, so whether ConfirmButtons is set to
false the buttons will always act as though it was set to
You can change the font size of the button text with the dButtonFontSize variable.
When back testing on a chart, the Strategy Tester report will supply you with summary details of the account balance and relative drawdown. You can also see a graph of how the balance increased, together with the equity at that point. The problem with this graph is that each point is displayed only when a trade closes. It does not show the balance and equity over time, which is what the Statistics settings will allow you to do.
In order to produce a statistics report, you must set SaveStats to
true. If you want to save the statistics for a forward test, you should leave the StatsInitialise parameter at its default setting of
false so that new data will be added to the existing file. When you are backtesting it will automatically be set to
true so that a new statistics file is created for each backtest. So you only need to change StatsInitialise to
true when you would like to close an existing stats file and start a new one.
You also need to decide how often to store the statistics information, and setting StatsPeriod to
3600 will save the statistics data once every hour, which provides a reasonable number of data points for a 2 or 3 year back test.
The data from the Statistics function will be stored in a .csv file in the Experts/Files folder if forward testing, or the Tester/Files folder if back testing. The file name will be taken from the UserComment parameter.
For a detailed explanation of what to do with this data read the Creating an Equity Chart page on the Wiki.
Thanks to ianj for providing the idea and original code.
Setting UseEmail to
true will allow Price Action to keep you informed by Email, as long as Emails are enabled in the MT4 platform (Tools - Options - Email).
You will be sent emails under the following conditions:
- When the drawdown of the chart reaches pre-defined levels. The levels are defined with EmailDD1, EmailDD2 and EmailDD3. If the price is fluctuating around one of the levels, to ensure that you are not inundated with emails, Price Action will wait for EmailHours before sending another one, unless the drawdown reaches the next level, when an email will be sent immediately.
- If ShutDown is set to
true, you will be informed when the basket has closed.
Sounds will play under the following conditions:
- When Opening a trade
- When Closing a trade
- When Price Action starts after a holiday shutdown
- When Price Action stops for a holiday shutdown
- When the Email drawdown levels are reached
- When the Portion Balance drops below the Stop Trade Balance
- When Trading is stopped for any reason
If you have installed the JTA Dashboard on another chart, then all the important information from the overlay will also be displayed on the Dashboard.
The chart overlay will also have another button showing DB, which will automatically bring the Dashboard chart window to the top.
Please read the JTA Dashboard Manual for further details.
Price Action makes use of our proprietary Trade Closer function, which allows each chart to help to close trades from other charts in order to maximise the usage of all 8 channels to the broker available for EAs.
Please read the Trade Closer page for further details.
|Disclaimer||Copyright © 1995-2016 J Talon LLC, All rights reserved|