This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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__) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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__) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
NewerOlder