PSX Dip Buy Strategy Backtester & Optimizer Tool — Free Online Calculator for Pakistan Stock Exchange

PSX Strategy Optimizer

PSX Strategy Optimizer

Backtest dip-buy strategies on Pakistan Stock Exchange historical data — 100% client-side.

The Basic Idea

This is a "buy the dip" strategy. When a stock's price falls from its opening price during the day, you buy at those lower levels. If the price bounces back to your target, you sell for profit. You split your money into parts so you don't put everything in at once — you buy more as it gets cheaper.

Full Example: Buying FFC with PKR 300,000

Let's say you pick these settings after running the optimizer:

Capital = PKR 300,000 Parts = 6 Buy Levels = 1%, 2%, 3%, 4%, 5% Target = 2%

Step 1 — Split your capital into parts:

PKR 300,000 ÷ 6 parts = PKR 50,000 per part

Step 2 — Calculate buy prices (assuming FFC opens at Rs. 150):

1% drop → 150 × (1 - 0.01) = Rs. 148.50 → spend 50,000 → get 337 shares 2% drop → 150 × (1 - 0.02) = Rs. 147.00 → spend 50,000 → get 340 shares 3% drop → 150 × (1 - 0.03) = Rs. 145.50 → spend 50,000 → get 344 shares 4% drop → 150 × (1 - 0.04) = Rs. 144.00 → spend 50,000 → get 347 shares 5% drop → 150 × (1 - 0.05) = Rs. 142.50 → spend 50,000 → get 351 shares

Step 3 — What actually happens during the day?

A
WIN scenario — Price drops 3% then bounces back:
You triggered buys at 1%, 2%, and 3% levels (3 parts used = PKR 150,000).
Total shares: 337 + 340 + 344 = 1,021 shares
Average buy price: PKR 150,000 ÷ 1,021 = Rs. 146.97
Your target: 146.97 × 1.02 = Rs. 149.91
If the day's HIGH reaches Rs. 149.91 → PROFIT = Rs. 3,002
B
LOSS scenario — Price drops 5% and stays down:
You triggered all 5 buy levels (5 parts used = PKR 250,000).
Total shares: 1,719 shares. Average price: Rs. 145.44
Target: Rs. 148.35 — but the day's HIGH never reaches it.
Market closes at Rs. 143.00 → LOSS = Rs. 4,196
(This is a "stuck day" in the tool's language)
C
NO TRADE scenario — Price never drops 1%:
The day's LOW stays above Rs. 148.50. None of your buy levels trigger.
No profit, no loss — you simply skip the day.

How to Actually Trade This on PSX

1
Before market opens (9:00 AM), note your stock's expected opening price (check the pre-open session or previous close).
2
Calculate your buy prices: Buy Price = Open × (1 - Level%) for each level.
3
Place limit buy orders at each calculated price in your brokerage app (KTrade, MyTrade, PSX Edge, or call your broker). Each order amount = Capital ÷ Parts.
4
After your first buy triggers, calculate your average buy price and set a limit sell order at: Target = Avg Price × (1 + Target%)
5
At market close (3:30 PM), if target was NOT hit, sell at closing price to free up capital for next day. Do NOT hold overnight — this is a same-day strategy.

Reading the Results

  • Total Profit — How much money you would have made over all days tested. Positive = good.
  • Win Rate — Out of all days you traded, what percentage hit the target. Above 60% is solid. Above 70% is excellent.
  • Max Loss — Your single worst day. This tells you the worst-case pain. Keep this small.
  • Stuck Days — Days where price dropped enough to trigger buys but never bounced to target. These are your risk days. Fewer is better.
  • Score — Combined number rewarding high profit + high win rate + low max loss. Higher = better overall.

What the Optimizer Does

Tests many combinations automatically. For example:

[1%,2%,3%,4%] with 1% target → Score: 450 [1%,2%,3%,4%] with 1.5% target → Score: 680 [1%,2%,3%,4%] with 2% target → Score: 820 ← winner [1%,2%,3%,4,5%] with 1% target → Score: 390 ... and so on for all combinations

Then ranks by Score and shows the best combination — that's the one you should use in real trading.

Pro Tip: Always run the optimizer on at least 6-12 months of data. A strategy that looks good on 1 month might fail in another. More data = more reliable results.
Warning: Past performance does NOT guarantee future results. Use small amounts first. Never invest money you can't afford to lose. This tool is for educational and research purposes only.
Choose Import Method
1
Console Snippet RECOMMENDED
Run a short script on the PSX website. It fetches all 12 months and copies data to clipboard.
2
Paste CSV
From Excel, Google Sheets, or any CSV source.
3
Paste HTML Table
Copy the raw HTML table from PSX page source or Network tab.
Console Snippet Method
1Open dps.psx.com.pk/historical in your browser
2Press F12 → go to Console tab
3Click "Copy Snippet" below, paste it in Console, press Enter
4It asks for symbol & year, fetches 12 months, copies JSON to clipboard
5Come back here and click Import from Clipboard
Loaded Data
No data loaded yet.
Log
Ready. Use the Console Snippet method for easiest data import.
Data Preview
No data loaded yet
Strategy Parameters
Select a symbol with loaded data, configure parameters, then run.
Optimization Config
Select a symbol and run optimization.
Multi-Stock Comparison
Load data for multiple symbols first, then click "Optimize All Loaded".

Post a Comment

0 Comments