Skip to content

Instantly share code, notes, and snippets.

View Chimezirim-Bassey's full-sized avatar

Chimezirim Bassey Chimezirim-Bassey

View GitHub Profile
# src/traders/exit_at_profit.py
import asyncio
from logging import getLogger
from aiomql import Config, Positions
logger = getLogger(__name__)
async def exit_at_profit(*, interval: float = 10):
"""Exit a position after a certain amount of profit has been reached starting from the entry price.
# src/trackers/exit_at_point.py
"""
Exit a position after a certain amount of points has been reached starting from the entry price.
"""
import asyncio
from logging import getLogger
from aiomql import Config, Positions, Symbol
logger = getLogger(__name__)
import asyncio
from logging import getLogger
from aiomql import Config, Positions, Symbol, TimeFrame, TradePosition, OrderType
logger = getLogger(__name__)
async def finger_trap_exit(*, interval: int = 60):
config = Config()
import logging
from aiomql import Symbol, Strategy, TimeFrame, Sessions, OrderType, Trader, Tracker, Candles, RAM
from ..traders import SimpleTrader
from ..utils.candle_patterns import swing_low, swing_high
logger = logging.getLogger(__name__)
from typing import Self
from os import environ
from dotenv import load_dotenv, dotenv_values
class Config:
_instance: Self
# you can add type hints here if you want
from logging import getLogger
from aiomql import OrderType, Trader
logger = getLogger(__name__)
class ScalpTrader(Trader):
async def place_trade(self, *, order_type: OrderType, volume: float = None, parameters: dict = None):
"""Places a trade based on the order_type and volume. The volume is optional. If not provided, the minimum volume
import logging
from datetime import datetime, UTC
from aiomql.lib.backtester import BackTester
from aiomql.core import Config
from aiomql.contrib.strategies import FingerTrap
from aiomql.contrib.symbols import ForexSymbol
from aiomql.core.backtesting import BackTestEngine
import logging
from aiomql.lib.bot import Bot
from aiomql.contrib.strategies import FingerTrap
from aiomql.contrib.symbols import ForexSymbol
def sample_bot():
logging.basicConfig(level=logging.INFO, format="%(asctime)s - %(name)s - %(levelname)s - %(message)s")
syms = ["Volatility 75 Index", "Volatility 100 Index", "Volatility 50 Index"]
import asyncio
from datetime import datetime
from pytz import timezone
from aiomql import ForexSymbol, Positions, History, Order, OrderType, RAM, TradeAction, MetaTrader
async def main():
async with MetaTrader() as mt5:
pos = Positions()
@Chimezirim-Bassey
Chimezirim-Bassey / bookish-robot_candles.py
Last active November 26, 2024 21:10
bookish-robot_candles.py
import asyncio
from aiomql import MetaTrader, Candle, Candles, TimeFrame
async def main():
async with MetaTrader() as mt5:
# get price bars from the terminal for the last 200 bars
bars = await mt5.copy_rates_from_pos("EURUSD", TimeFrame.M1, 0, 200)