APSAT Assignment-5


Price Levels Based Trading Strategy

One of the most common trading strategies is to Buy when price goes above resistance level, and Short when price goes below support level. There can be different versions of Buy and Sell logic depending upon number of support/resistance levels as well as trend.
Identifying the suppport/resistance level is key and can be done by either:
1. Marking the levels discretionary and input them from Chart parameters window
2. Using Highest High / Lowest Low of previous n bars
3. Using Standard Deviation bands
4. Using ATR Bands
5. Using Moving Average Bands
The following assignment from APSAT makes you learn how to code such strategies. When you submit the assignment questions, we will email you the solutions 🙂


Assume the following set of input parameters which can be set through chart:
per31= Param(“Long Line”, 0, 0, 50000, 0.05);
per32= Param(“Long Target”, 0, 0, 50000, 0.05);
per33= Param(“Long SL”, 0, 0, 50000, 0.05);
per34= Param(“Long TSL”, 0, 0, 50000, 0.05);
per10= Param(“Trade Entry From(HHMM)”, 940, 900, 2300, 1);
per11= Param(“Trade Entry Upto(HHMM)”, 1500, 900, 2300, 1);
per12= Param(“Trade Exit(HHMM)”, 1515, 900, 2300, 1);


1. Write a code to plot the Long Line/Target/SL/TSL only when they are given non-zero value through charts parameter window
2. Modify code in part1 to Buy when prices crosses above Long line ONLY at the first instance in current day
3. Modify code in part2 so that a fixed SL can be set when Long signal is generated
4. Modify code in part3 so that a target can be set when Long signal is generated
5. Modify code in part4 so that a TSL can be set when Long signal is generated
6. Modify code in part5 to add Short-Cover side also
[ARForms id=107]