Trading & Behavioral Analytics
Production Active
Streamlit • Plotly • Python
Quantitative Trade Journal & Behavioral Expectancy Dashboard
An interactive analytics workspace correlating execution psychology (FOMO, Revenge Trading, Flow State) with statistical metrics (R-Multiple distribution, Expectancy, Win Rate, and Session Alpha).
Expectancy / Trade
+1.42 R
Average net gain
Discipline Score
92%
Plan adherence
Visual Charts
Plotly 3D
Interactive graphs
Broker Import
MT5 & CSV
Auto trade sync
The Problem
Traders fail not because of strategy defects, but due to psychological mistakes: revenge trading after losses, moving stop-losses prematurely, or taking low-probability setups during lunch hours without logging metrics.
The Solution
Built an interactive analytical dashboard in Python and Streamlit. Correlates emotional tags with PnL, expectancy, and session timing, revealing which setups and mental states yield the highest mathematical edge.
Trade Expectancy Engine
# Trade Expectancy & Behavioral Tilt Matrix
import pandas as pd
import numpy as np
def analyze_trade_psychology(journal_df: pd.DataFrame) -> dict:
# Group by emotional tag (e.g., Disciplined, FOMO, Revenge)
grouped = journal_df.groupby('emotional_tag').agg({
'r_multiple': ['count', 'mean', lambda x: (x > 0).mean()],
'pnl_usd': 'sum'
})
grouped.columns = ['Trade_Count', 'Avg_R_Multiple', 'Win_Rate', 'Total_PnL']
# Calculate overall mathematical expectancy
win_rate = (journal_df['r_multiple'] > 0).mean()
loss_rate = 1.0 - win_rate
avg_win_r = journal_df[journal_df['r_multiple'] > 0]['r_multiple'].mean()
avg_loss_r = abs(journal_df[journal_df['r_multiple'] < 0]['r_multiple'].mean())
expectancy_r = (win_rate * avg_win_r) - (loss_rate * avg_loss_r)
return {
"overall_expectancy_r": round(float(expectancy_r), 2),
"win_rate_percent": round(win_rate * 100, 1),
"emotional_breakdown": grouped.to_dict(orient='index')
}
"Majid's journaling dashboard helped me identify that 80% of my trading losses occurred when trading FOMO impulses after 3 PM. Eliminating that single behavior doubled my monthly profitability."
Sameer Khan
Full-Time Forex Trader • Independent (Karachi)