Pół roku na forex
Re: Pół roku na forex
Muszę dopisać jeszcze jedno do tego. Początkowo ciężko pojąć niektóre rady RZ, sam je pomijałem, ale nawiązując do tego co napisałem wyżej, analizując jego metodologię, mówił np w piramidzie tradera że buduje pozycje do pewnego momentu rozkładając pozycje na mniejsze części. Że jak chce otworzyć 10 lota to czasem według sygnału otworzysz tylko 5 lota. Myślę że to przychodzi z czasem, kiedy nabierasz respektu do rynku, kiedy widzisz że to co sobie ubzdurałeś i namalowałeś na ekranie monitora (wykresie) się nie zrealizowało tak jak sobie zaplanowałeś. Wtedy dochodzisz do wniosku, że może lepiej zgarnać z rynku 100, 200 zł, połową tego co planowałeś otworzyć, niż zaliczyć SLK i stracić połowę kapitału. Ale to są tylko dwa pojedyczne elementy całej układanki, jest tego więcej, co można wyjąć z jego nagrań. Ale to już... tylko tak sobie jeszcze teraz o tym przypomniałem, a na pewno wiele osób to olewa, tak jak ja kiedyś. Tak samo jak to że kiedyś wspominał o tym że wychodzi z pozycji na ważnych poziomach tj wsparcia i opory, po prostu statystyka. I tak dalej.... Jest co rozkminiać i z tego co ostatnio się dowiedziałem podobno zaliczył 'fuck up' ale i tak ta wiedza jest ciągle aktualna.
Re: Pół roku na forex
Chodziło chyba bardziej o to że "powszechanie znana" AT nie da ponad przeciętnych wyników/zsyków. Nawet te wyjścia co opisałem wyżej bez dobrych wejść i bez odpowiedniego MM dają straty...
Tutaj jest jest jeden z testów jakie robiłem na jforex (to EA robi wejścia z doopy, po porstu między 9-10 i jeśli najpierw stoch wjędzie na 20 to buy, jesli najpierw na 80 sell i tyle. to są testowe warunki do otwarcia pozycji. Ale podobno kostka też jest dobra więc what da hell i tak chodzi o sprawdzenie systemu wyjśc. Tyle że akurat tutaj lepiej byłoby wychodzi bez tego step, czekając na powrót stocha z 80 na 20 i odwrotnie, ale własnie od tego są testy żeby sprawdzać różne warianty. Trzeba po prostu wkleić do kodu nowej strategii i odpalić z wykresem, żeby zobaczyć co to robi)
Kod: Zaznacz cały
package jforex;
import java.util.*;
import com.dukascopy.api.*;
import com.dukascopy.api.IIndicators.AppliedPrice;
import com.dukascopy.api.IIndicators.MaType;
import com.dukascopy.api.IEngine.OrderCommand;
public class Strategy_29052020_WyjscieNaOdwrotnymStochu3 implements IStrategy {
private IEngine engine;
private IConsole console;
private IHistory history;
private IContext context;
private IIndicators indicators;
private IUserInterface userInterface;
private IOrder order;
private int counter = 0;
// stochastic settings
public OfferSide side = OfferSide.BID;
public MaType slowDMaType = MaType.SMA;
public MaType slowKMaType = MaType.SMA;
public int fastKPeriod = 7;
public int slowKPeriod = 3;
public int slowDPeriod = 2;
public int shift = 0;
public double amount = 0.1;
public Filters filters;
private IAccount account;
private int step = 0;
public void onStart(IContext context) throws JFException {
this.engine = context.getEngine();
this.console = context.getConsole();
this.history = context.getHistory();
this.context = context;
this.indicators = context.getIndicators();
this.userInterface = context.getUserInterface();
this.filters = new Filters();
for (int i = 0; i < engine.getOrders().size(); i++) {
Set<IChart> l = context.getCharts();
}
//context.stop();
}
public void onAccount(IAccount account) throws JFException {
this.account = account;
}
public void onMessage(IMessage message) throws JFException {
}
public void onStop() throws JFException {
}
public void onTick(Instrument instrument, ITick tick) throws JFException {
}
public void onBar(Instrument instrument, Period period, IBar askBar, IBar bidBar) throws JFException {
OrderCommand orderCommand = null;
Date date = new Date(bidBar.getTime());
IBar dailyBar = history.getBar(instrument, Period.DAILY, side, shift);
double[] stochM5 = indicators.stoch(instrument, Period.FIVE_MINS, side, fastKPeriod, slowKPeriod, slowKMaType, slowDPeriod, slowDMaType, shift);
// open order
if (filters.isNotWeekend(date) && date.getHours() == 9 && period.equals(Period.FIVE_MINS)) {
if (stochM5[0] < 20 && stochM5[1] < 20 && filters.isBullBar(bidBar)) {
orderCommand = OrderCommand.BUY;
sendOrder(instrument, orderCommand);
} else if (stochM5[0] > 80 && stochM5[1] > 80 && !filters.isBullBar(bidBar)) {
orderCommand = OrderCommand.SELL;
sendOrder(instrument, orderCommand);
} else {
//
}
}
if (engine.getOrders(instrument).size() > 0) {
for (IOrder order : engine.getOrders(instrument)) {
orderCommand = order.getOrderCommand();
}
if (orderCommand.equals(OrderCommand.BUY) && !filters.isBullBar(bidBar)) {
if (stochM5[0] > 80 && stochM5[1] > 80 && step == 0) {
step = 1;
}
if (step == 1 && stochM5[0] < 20 && stochM5[1] < 20) {
closeAllOrders(instrument);
step = 0;
}
} else if (orderCommand.equals(OrderCommand.SELL) && filters.isBullBar(bidBar)) {
if (stochM5[0] < 20 && stochM5[1] < 20 && step == 0) {
step = 1;
}
if (step == 1 && stochM5[0] > 80 && stochM5[1] > 80) {
closeAllOrders(instrument);
step = 0;
}
}
}
//console.getOut().format("%d %d %d %d \n", sbit, c1, c2, c3).println();
}
public void sendOrder(Instrument instrument, OrderCommand orderCommand) throws JFException {
if (engine.getOrders(instrument).size() > 0) return;
engine.submitOrder(getLabel(instrument), instrument, orderCommand, amount);
}
public void closeAllOrders(Instrument instrument) throws JFException {
if (engine.getOrders(instrument).size() == 0) return;
for (IOrder order : engine.getOrders(instrument)) {
order.close();
}
}
protected String getLabel(Instrument instrument) {
String label = instrument.name();
label = label + System.currentTimeMillis() + (++counter);
label = label.toUpperCase();
return label;
}
public void print(Object o) {
console.getOut().println(o);
}
private class Filters {
public Filters() {}
public boolean isNotWeekend(Date date) {
return (date.getDay() != 6 && date.getDay() != 7) ? true : false;
}
public boolean isBullBar(IBar bar) {
return (bar.getOpen() > bar.getClose()) ? false : true;
}
}
}